Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions chmodzip.d
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ int main(string[] args)
zr.expand(de);
writefln("name = %s", de.name);
writefln("\tcomment = %s", de.comment);
writefln("\tmadeVersion = x%04x", de.madeVersion);
writefln("\textractVersion = x%04x", de.extractVersion);
writefln("\tflags = x%04x", de.flags);
writefln("\tcompressionMethod = %d", de.compressionMethod);
writefln("\tcrc32 = x%08x", de.crc32);
writefln("\texpandedSize = %s", de.expandedSize);
writefln("\tcompressedSize = %s", de.compressedSize);
writefln("\teattr = %03o, %03o", de.externalAttributes >> 16, de.externalAttributes & 0xFFFF);
writefln("\teattr = %03o, %03o", de.fileAttributes);
writefln("\tiattr = %03o", de.internalAttributes);
//writefln("\tdate = %s", std.date.toString(std.date.toDtime(de.time)));
writefln("\tdate = %s", SysTime(unixTimeToStdTime((de.time))));
Expand Down Expand Up @@ -74,11 +73,10 @@ L1:

foreach (member; members)
{
if (de.name == member && ((de.externalAttributes >> 16) & octal!7777) != newattr)
if (de.name == member && (de.fileAttributes & octal!7777) != newattr)
{
changes = true;
de._madeVersion = 0x317; // necessary or linux unzip will ignore attributes
de.externalAttributes = (de.externalAttributes & ~(octal!7777 << 16)) | (newattr << 16);
de.fileAttributes = de.fileAttributes & ~octal!7777 | newattr;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about these changes - on one hand if the script wasn't building no idea if it was actually used any more, on the other hand this needs to work correctly so that unzipping .zip files on POSIX results in the correct attributes being set for files, and I doubt this is tested automatically anywhere right now. @MartinNowak ?

break;
}
}
Expand Down
116 changes: 116 additions & 0 deletions circle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/bin/bash

set -uexo pipefail

HOST_DMD_VER=2.072.2 # same as in dmd/src/posix.mak
TRAVIS_BRANCH=${TRAVIS_BRANCH:-master}
DMD="../dmd/src/dmd"
CURL_USER_AGENT="CirleCI $(curl --version | head -n 1)"
N=2
CIRCLE_NODE_INDEX=${CIRCLE_NODE_INDEX:-0}

case $CIRCLE_NODE_INDEX in
0) MODEL=64 ;;
1) MODEL=32 ;;
esac

install_deps() {
if [ $MODEL -eq 32 ]; then
sudo apt-get update
sudo apt-get install g++-multilib
fi

for i in {0..4}; do
if curl -fsS -A "$CURL_USER_AGENT" --max-time 5 https://dlang.org/install.sh -O ||
curl -fsS -A "$CURL_USER_AGENT" --max-time 5 https://nightlies.dlang.org/install.sh -O ; then
break
elif [ $i -ge 4 ]; then
sleep $((1 << $i))
else
echo 'Failed to download install script' 1>&2
exit 1
fi
done

source "$(CURL_USER_AGENT=\"$CURL_USER_AGENT\" bash install.sh dmd-$HOST_DMD_VER --activate)"
$DC --version
env
}

clone() {
local url="$1"
local path="$2"
local branch="$3"
for i in {0..4}; do
if git clone --depth=1 --branch "$branch" "$url" "$path"; then
break
elif [ $i -lt 4 ]; then
sleep $((1 << $i))
else
echo "Failed to clone: ${url}"
exit 1
fi
done
}

test_rdmd() {
# run rdmd internal tests
rdmd --compiler=$DMD -m$MODEL -main -unittest rdmd.d

# compile rdmd & testsuite
$DMD -m$MODEL rdmd.d
$DMD -m$MODEL rdmd_test.d

# run rdmd testsuite
./rdmd_test --compiler=$DMD
}

setup_repos()
{
local base_branch="master"
if [ -n "${CIRCLE_PR_NUMBER:-}" ]; then
base_branch=$((curl -fsSL https://api.github.com/repos/dlang/tools/pulls/$CIRCLE_PR_NUMBER || echo) | jq -r '.base.ref')
else
base_branch=$CIRCLE_BRANCH
fi
# merge upstream branch with changes, s.t. we check with the latest changes
if [ -n "${CIRCLE_PR_NUMBER:-}" ]; then
local current_branch=$(git rev-parse --abbrev-ref HEAD)
git config user.name dummyuser
git config user.email dummyuser@dummyserver.com
git remote add upstream https://github.com/dlang/tools.git
git fetch upstream
git checkout -f upstream/$base_branch
git merge -m "Automatic merge" $current_branch
fi

for repo in dmd druntime phobos dlang.org installer ; do
if [ ! -d "../${repo}" ] ; then
if [ $TRAVIS_BRANCH != master ] && [ $TRAVIS_BRANCH != stable ] &&
! git ls-remote --exit-code --heads https://github.com/dlang/$proj.git $TRAVIS_BRANCH > /dev/null; then
# use master as fallback for other repos to test feature branches
clone https://github.com/dlang/${repo}.git ../${repo} master
else
clone https://github.com/dlang/${repo}.git ../${repo} $TRAVIS_BRANCH
fi
fi
done

make -j$N -C ../dmd/src -f posix.mak MODEL=$MODEL HOST_DMD=dmd all
make -j$N -C ../druntime -f posix.mak MODEL=$MODEL HOST_DMD=$DMD
make -j$N -C ../phobos -f posix.mak MODEL=$MODEL HOST_DMD=$DMD
}

build_tools()
{
# TODO: fix changed
make -f posix.mak catdoc ddemangle detab dget dman dustmite tolf
}

case $1 in
install-deps) install_deps ;;
setup-repos) setup_repos ;;
build-tools) build_tools;;
test-rdmd) test_rdmd ;;
*) echo "Unknown command"; exit 1;;
esac
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of boilerplate that's going to need to be kept in sync across repos. Any ideas on DRY?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, how feasible is to have a single script file that works with both Travis and Circle CI?

11 changes: 11 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dependencies:
pre:
- ./circle.sh install-deps
cache_directories:
- "~/dlang"

test:
override:
- ./circle.sh setup-repos
- ./circle.sh build-tools
- ./circle.sh test_rdmd
2 changes: 1 addition & 1 deletion dman.d
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ string CHeader(string topic)
static string[] dmccmds =
[
"assert.h", "complex.h", "ctype.h", "fenv.h",
"float.h", "locale.h", "math.h", "setjmp.h,"
"float.h", "locale.h", "math.h", "setjmp.h",
"signal.h", "stdarg.h", "stddef.h", "stdio.h",
"stdlib.h", "string.h", "time.h", "gc.h",
"bios.h", "cerror.h", "disp.h", "dos.h",
Expand Down
24 changes: 18 additions & 6 deletions rdmd_test.d
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ void main(string[] args)
"concurrency", &concurrencyTest,
);

// if the compiler contains a dir separator, it's not the in the global PATH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is some grammar bug here

// but a relative path
// an absolute path or executable in the PATH is required as the test suite
// used chdir
if (compiler.canFind(dirSeparator))
compiler = compiler.asAbsolutePath.array;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just .toAbsolutePath?


enforce(rdmd.exists, "Path to rdmd does not exist: %s".format(rdmd));

rdmdApp = tempDir().buildPath("rdmd_app_") ~ binExt;
Expand Down Expand Up @@ -347,15 +354,20 @@ void runTests()
assert(res.status == 0, res.output);
assert(!res.output.canFind("compile_force_src"));

auto fullCompilerPath = environment["PATH"]
.splitter(pathSeparator)
.map!(dir => dir.buildPath(compiler ~ binExt))
.filter!exists
.front;
// for absolute compiler path, we make the path relative again
string fullCompilerPath = void;
if (compiler.isAbsolute)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess technically this wasn't necessary since buildPath with an absolute path will always result in that absolute path, but I guess this is more efficient and results in a better error if the path doesn't exist.

fullCompilerPath = compiler.asRelativePath(getcwd()).array;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, why is this branch computing a relative path when the other branch is computing an absolute one?

else
fullCompilerPath = environment["PATH"]
.splitter(pathSeparator)
.map!(dir => dir.buildPath(compiler ~ binExt))
.filter!exists
.front;

res = execute([rdmdApp, "--compiler=" ~ fullCompilerPath, forceSrc]);
assert(res.status == 0, res.output ~ "\nCan't run with --compiler=" ~ fullCompilerPath);
assert(res.output.canFind("compile_force_src"));
assert(res.output.canFind("compile_force_src"), "Can't find compile_force_src");

// Create an empty temporary directory and clean it up when exiting scope
static struct TmpDir
Expand Down
44 changes: 0 additions & 44 deletions travis.sh

This file was deleted.