diff --git a/chmodzip.d b/chmodzip.d index 0476d8072e..ac960ec583 100644 --- a/chmodzip.d +++ b/chmodzip.d @@ -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)))); @@ -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; break; } } diff --git a/circle.sh b/circle.sh new file mode 100755 index 0000000000..2b8cc53ea3 --- /dev/null +++ b/circle.sh @@ -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 diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000000..d8dd9ef7f5 --- /dev/null +++ b/circle.yml @@ -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 diff --git a/dman.d b/dman.d index 4d12aaa023..3a015fc3de 100644 --- a/dman.d +++ b/dman.d @@ -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", diff --git a/rdmd_test.d b/rdmd_test.d index 33a0187a7b..13ca103b43 100644 --- a/rdmd_test.d +++ b/rdmd_test.d @@ -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 + // 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; + enforce(rdmd.exists, "Path to rdmd does not exist: %s".format(rdmd)); rdmdApp = tempDir().buildPath("rdmd_app_") ~ binExt; @@ -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) + fullCompilerPath = compiler.asRelativePath(getcwd()).array; + 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 diff --git a/travis.sh b/travis.sh deleted file mode 100755 index 90c577e121..0000000000 --- a/travis.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -set -uexo pipefail - -DIGGER_DIR="../digger" -DIGGER="../digger/digger" - -# set to 64-bit by default -if [ -z ${MODEL:-} ] ; then - MODEL=64 -fi - -test_rdmd() { - # run rdmd internal tests - rdmd -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 -} - -build_digger() { - git clone --recursive https://github.com/CyberShadow/Digger "$DIGGER_DIR" - (cd "$DIGGER_DIR" && rdmd --build-only -debug digger) -} - -install_digger() { - $DIGGER build --model=$MODEL "master" - export PATH=$PWD/result/bin:$PATH -} - -if ! [ -d "$DIGGER_DIR" ] ; then - build_digger -fi - -install_digger - -dmd --version -rdmd --help | head -n 1 - -test_rdmd