fix windows tests
This commit is contained in:
parent
9e80391744
commit
53f95ed1c4
|
|
@ -103,17 +103,8 @@ jobs:
|
|||
rdmd ./d-test-utils/test_with_package.d $LIBDPARSE_VERSION libdparse -- dub build --build=${{ matrix.build }} --config=client --arch=${{ matrix.arch }}
|
||||
rdmd ./d-test-utils/test_with_package.d $LIBDPARSE_VERSION libdparse -- dub build --build=${{ matrix.build }} --config=server --arch=${{ matrix.arch }}
|
||||
|
||||
- name: Linux Tests
|
||||
if: contains(matrix.os, 'ubuntu')
|
||||
- name: Tests
|
||||
run: |
|
||||
./run_tests.sh --extra
|
||||
working-directory: tests
|
||||
shell: bash
|
||||
|
||||
- name: Windows and MacOS Tests
|
||||
if: contains(matrix.os, 'windows') || contains(matrix.os, 'macos')
|
||||
run: |
|
||||
./run_tests.sh --extra
|
||||
working-directory: tests
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
// Then it calls all functions with every type to see which ones are accepted by
|
||||
// the compiler, to automatically stay up-to-date.
|
||||
|
||||
import std;
|
||||
import fs = std.file;
|
||||
import std;
|
||||
|
||||
string[] testTypes = [
|
||||
"bool",
|
||||
|
|
@ -129,7 +129,10 @@ int main(string[] args)
|
|||
|
||||
fs.write("proc_test.d", code);
|
||||
|
||||
auto output = executeShell("$DC -verrors=0 $ERROR_STYLE -c proc_test.d").output;
|
||||
version (Windows)
|
||||
auto output = executeShell("%DC% -verrors=0 %ERROR_STYLE% -c proc_test.d").output;
|
||||
else
|
||||
auto output = executeShell("$DC -verrors=0 $ERROR_STYLE -c proc_test.d").output;
|
||||
|
||||
size_t numErrors = 0;
|
||||
|
||||
|
|
@ -152,7 +155,8 @@ int main(string[] args)
|
|||
}
|
||||
}
|
||||
|
||||
enforce(numErrors > 1_000, "compiler didn't error as expected, need to adjust tests!");
|
||||
enforce(numErrors > 1_000, "compiler didn't error as expected, need to adjust tests!\n\nSample of compiler output:\n"
|
||||
~ output[0..min($, 1000)]);
|
||||
|
||||
writeln("Total incompatible type combinations: ", numErrors);
|
||||
|
||||
|
|
@ -164,8 +168,11 @@ int main(string[] args)
|
|||
~ "\n"
|
||||
~ varName ~ ".func_";
|
||||
|
||||
string[] dcdClient = ["../../../bin/dcd-client"];
|
||||
if (args[1].length)
|
||||
version (Windows)
|
||||
string[] dcdClient = ["..\\..\\..\\bin\\dcd-client"];
|
||||
else
|
||||
string[] dcdClient = ["../../../bin/dcd-client"];
|
||||
if (args.length > 1 && args[1].length)
|
||||
dcdClient ~= args[1];
|
||||
|
||||
auto proc = pipeProcess(dcdClient ~ ["-c" ~ to!string(input.length)]);
|
||||
|
|
@ -178,9 +185,12 @@ int main(string[] args)
|
|||
size_t i = 0;
|
||||
foreach (line; proc.stdout.byLineCopy)
|
||||
{
|
||||
if (line.length && line[$ - 1] == '\r')
|
||||
line = line[0 .. $ - 1];
|
||||
|
||||
if (i++ == 0)
|
||||
{
|
||||
enforce(line == "identifiers");
|
||||
enforce(line == "identifiers", "Invalid DCD stdout first line: " ~ line);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,4 +21,4 @@ fi
|
|||
export DC ERROR_STYLE
|
||||
# gdc uses language specific error message
|
||||
export LC_ALL=${LC_ALL:-"C.UTF-8"}
|
||||
${DC} -run generate_tests.d "${1}"
|
||||
${DC} -run generate_tests.d "$1"
|
||||
|
|
|
|||
|
|
@ -90,6 +90,12 @@ function waitShutdown()
|
|||
fi
|
||||
}
|
||||
|
||||
if [ -n "$COMSPEC" ]; then
|
||||
# Make sure all line endings are \n and not \crlf
|
||||
shopt -s globstar
|
||||
sed -i 's/\r$//' **/*.d
|
||||
fi
|
||||
|
||||
# Make sure that the server is shut down
|
||||
if [[ "$REUSE_SERVER" == "1" ]]; then
|
||||
echo "Not shutting down existing server due to --reuse-server"
|
||||
|
|
@ -129,7 +135,20 @@ for socket in $SOCKETMODES; do # supported: unix tcp
|
|||
for testCase in $TESTCASES $EXTRA_TESTCASES; do
|
||||
cd $testCase
|
||||
|
||||
./run.sh "$tcp"
|
||||
TESTCWD="$(pwd)"
|
||||
SLASH="/"
|
||||
SLASHSLASH="/"
|
||||
WINDOWS=0
|
||||
if [ -n "$COMSPEC" ]; then
|
||||
# is running on windows (transform /d/a/DCD/... to D:/a/DCD/...)
|
||||
SLASH="\\\\"
|
||||
SLASHSLASH="\\\\\\\\"
|
||||
WINDOWS=1
|
||||
DRIVE="${TESTCWD:1:1}"
|
||||
TESTCWD="${DRIVE^^}:${TESTCWD:2}"
|
||||
fi
|
||||
|
||||
env TESTCWD="$TESTCWD" SLASH="$SLASH" SLASHSLASH="$SLASHSLASH" WINDOWS="$WINDOWS" ./run.sh "$tcp"
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo -e "${YELLOW}$socket:$testCase:${NORMAL} ... ${GREEN}Pass${NORMAL}";
|
||||
let pass_count=pass_count+1
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
/expected1.txt
|
||||
|
|
@ -1 +0,0 @@
|
|||
/imports/std/stdio.d 0
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
set -e
|
||||
set -u
|
||||
|
||||
../../bin/dcd-client $1 file.d -l -c 15 | sed s\""$(dirname "$(pwd)")"\"\" > actual1.txt
|
||||
../../bin/dcd-client $1 file.d -l -c 15 > actual1.txt
|
||||
printf "$(dirname "${TESTCWD}")/imports${SLASHSLASH}std${SLASHSLASH}stdio.d\t0\n" > expected1.txt
|
||||
diff actual1.txt expected1.txt --strip-trailing-cr
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
set -e
|
||||
set -u
|
||||
|
||||
../../bin/dcd-client $1 file.d -u -c22 | sed s\""$(dirname "$(pwd)")"\"\" > actual1.txt
|
||||
../../bin/dcd-client $1 file.d -u -c22 | sed s\""$(dirname "${TESTCWD}")"\"\" > actual1.txt
|
||||
diff actual1.txt expected1.txt --strip-trailing-cr
|
||||
|
||||
# should work on last character of identifier
|
||||
../../bin/dcd-client $1 file.d -u -c24 | sed s\""$(dirname "$(pwd)")"\"\" > actual2.txt
|
||||
../../bin/dcd-client $1 file.d -u -c24 | sed s\""$(dirname "${TESTCWD}")"\"\" > actual2.txt
|
||||
diff actual2.txt expected1.txt --strip-trailing-cr
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
/expected1.txt
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
/imports/object.d 22
|
||||
0
|
||||
12
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
set -e
|
||||
set -u
|
||||
|
||||
../../bin/dcd-client $1 file.d -u -c1 | sed s\""$(dirname "$(pwd)")"\"\" > actual1.txt
|
||||
../../bin/dcd-client $1 file.d -u -c1 > actual1.txt
|
||||
printf "$(dirname "${TESTCWD}")/imports${SLASHSLASH}object.d\t22\n0\n12\n" > expected1.txt
|
||||
diff actual1.txt expected1.txt --strip-trailing-cr
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
set -e
|
||||
set -u
|
||||
|
||||
../../bin/dcd-client $1 file.d -u -c8 | sed s\""$(dirname "$(pwd)")"\"\" > actual1.txt
|
||||
../../bin/dcd-client $1 file.d -u -c8 | sed s\""$(dirname "${TESTCWD}")"\"\" > actual1.txt
|
||||
diff actual1.txt expected1.txt --strip-trailing-cr
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
set -e
|
||||
set -u
|
||||
|
||||
../../bin/dcd-client $1 file.d -c 15 | sed s\""$(dirname "$(pwd)")"\"\" > actual3.txt
|
||||
../../bin/dcd-client $1 file.d -c 15 | sed s\""$(dirname "${TESTCWD}")"\"\" > actual3.txt
|
||||
diff actual3.txt expected3.txt --strip-trailing-cr
|
||||
|
||||
../../bin/dcd-client $1 -I bar.d
|
||||
|
||||
../../bin/dcd-client $1 file.d -c 15 | sed s\""$(dirname "$(pwd)")"\"\" > actual1.txt
|
||||
../../bin/dcd-client $1 file.d -c 15 | sed s\""$(dirname "${TESTCWD}")"\"\" > actual1.txt
|
||||
diff actual1.txt expected1.txt --strip-trailing-cr
|
||||
|
||||
../../bin/dcd-client $1 file.d -c 40 | sed s\""$(dirname "$(pwd)")"\"\" > actual2.txt
|
||||
../../bin/dcd-client $1 file.d -c 40 | sed s\""$(dirname "${TESTCWD}")"\"\" > actual2.txt
|
||||
diff actual2.txt expected2.txt --strip-trailing-cr
|
||||
|
||||
../../bin/dcd-client $1 -R bar.d
|
||||
|
||||
../../bin/dcd-client $1 file.d -c 15 | sed s\""$(dirname "$(pwd)")"\"\" > actual3.txt
|
||||
../../bin/dcd-client $1 file.d -c 15 | sed s\""$(dirname "${TESTCWD}")"\"\" > actual3.txt
|
||||
diff actual3.txt expected3.txt --strip-trailing-cr
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
set -e
|
||||
set -u
|
||||
|
||||
../../bin/dcd-client $1 -I $(pwd)
|
||||
../../bin/dcd-client $1 -I "$(pwd)"
|
||||
echo | ../../bin/dcd-client $1 --search funcName > actual1.txt
|
||||
echo -e "$(pwd)/file.d\tf\t5" > expected1.txt
|
||||
printf "${TESTCWD}${SLASHSLASH}file.d\tf\t5\n" > expected1.txt
|
||||
diff actual1.txt expected1.txt --strip-trailing-cr
|
||||
|
|
|
|||
|
|
@ -3,24 +3,24 @@ set -u
|
|||
|
||||
rm -f actual1.txt actual2.txt actual3.txt actual0.txt
|
||||
|
||||
../../bin/dcd-client $1 file1.d -c 137 | sed s\""$(dirname "$(pwd)")"\"\" > actual0.txt
|
||||
../../bin/dcd-client $1 file1.d -c 137 | sed s\""$(dirname "${TESTCWD}")"\"\" > actual0.txt
|
||||
diff actual0.txt expected0.txt --strip-trailing-cr
|
||||
|
||||
../../bin/dcd-client $1 -I bar.d
|
||||
|
||||
../../bin/dcd-client $1 file1.d -c 137 | sed s\""$(dirname "$(pwd)")"\"\" > actual1.txt
|
||||
../../bin/dcd-client $1 file1.d -c 137 | sed s\""$(dirname "${TESTCWD}")"\"\" > actual1.txt
|
||||
diff actual1.txt expected1.txt --strip-trailing-cr
|
||||
|
||||
../../bin/dcd-client $1 file1.d -c 152 | sed s\""$(dirname "$(pwd)")"\"\" > actual1_1.txt
|
||||
../../bin/dcd-client $1 file1.d -c 152 | sed s\""$(dirname "${TESTCWD}")"\"\" > actual1_1.txt
|
||||
diff actual1_1.txt expected1_1.txt --strip-trailing-cr
|
||||
|
||||
../../bin/dcd-client $1 file1.d -c 170 | sed s\""$(dirname "$(pwd)")"\"\" > actual2.txt
|
||||
../../bin/dcd-client $1 file1.d -c 170 | sed s\""$(dirname "${TESTCWD}")"\"\" > actual2.txt
|
||||
diff actual2.txt expected2.txt --strip-trailing-cr
|
||||
|
||||
../../bin/dcd-client $1 file2.d -c 83 | sed s\""$(dirname "$(pwd)")"\"\" > actual3.txt
|
||||
../../bin/dcd-client $1 file2.d -c 83 | sed s\""$(dirname "${TESTCWD}")"\"\" > actual3.txt
|
||||
diff actual3.txt expected3.txt --strip-trailing-cr
|
||||
|
||||
../../bin/dcd-client $1 -R bar.d
|
||||
|
||||
../../bin/dcd-client $1 file1.d -c 137 | sed s\""$(dirname "$(pwd)")"\"\" > actual0.txt
|
||||
../../bin/dcd-client $1 file1.d -c 137 | sed s\""$(dirname "${TESTCWD}")"\"\" > actual0.txt
|
||||
diff actual0.txt expected0.txt --strip-trailing-cr
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@ set -e
|
|||
set -u
|
||||
|
||||
../../bin/dcd-client $1 file.d --extended -I"$PWD"/newpackage -c$(wc -c < file.d) > actual1.txt
|
||||
echo -e "identifiers\nSomeStruct\ts\t\t$PWD/newpackage/newmodule.d 26\t\t" > expected1.txt
|
||||
printf "identifiers\nSomeStruct\ts\t\t${TESTCWD}/newpackage${SLASHSLASH}newmodule.d 26\t\t\n" > expected1.txt
|
||||
diff actual1.txt expected1.txt --strip-trailing-cr
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@ set -e
|
|||
set -u
|
||||
|
||||
../../bin/dcd-client $1 -c57 -l -I"$PWD"/barutils file.d > actual.txt
|
||||
echo -e "$PWD/barutils/barutils.d\t22" > expected.txt
|
||||
printf "${TESTCWD}/barutils${SLASHSLASH}barutils.d\t22\n" > expected.txt
|
||||
diff actual.txt expected.txt --strip-trailing-cr
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ set -u
|
|||
echo "import: $PWD/testing"
|
||||
|
||||
../../bin/dcd-client $1 app.d --extended -I $PWD/ -c50 > actual.txt
|
||||
echo -e "identifiers\nworld\tv\tWorld world\t$PWD/testing/a.d 77\t\tWorld" > expected.txt
|
||||
printf "identifiers\nworld\tv\tWorld world\t${TESTCWD}/testing${SLASHSLASH}a.d 77\t\tWorld\n" > expected.txt
|
||||
diff actual.txt expected.txt --strip-trailing-cr
|
||||
|
|
|
|||
Loading…
Reference in New Issue