diff --git a/compiler/test/fail_compilation/fail18243.d b/compiler/test/fail_compilation/fail18243.d index f31319b0d359..90a859f436fe 100644 --- a/compiler/test/fail_compilation/fail18243.d +++ b/compiler/test/fail_compilation/fail18243.d @@ -1,5 +1,5 @@ /* -EXTRA_FILES: imports/a18243.d +EXTRA_FILES: imports/a18243.d imports/b18243.d TEST_OUTPUT: --- fail_compilation/fail18243.d(15): Error: none of the overloads of `isNaN` are callable using argument types `!()(float)` diff --git a/compiler/test/fail_compilation/imports/a18243.d b/compiler/test/fail_compilation/imports/a18243.d index 73df7511cebc..35da731b444b 100644 --- a/compiler/test/fail_compilation/imports/a18243.d +++ b/compiler/test/fail_compilation/imports/a18243.d @@ -1,5 +1,5 @@ -module a18243; +module imports.a18243; -import std.math : isNaN; +import imports.b18243 : isNaN; public bool isNaN() { return false; } diff --git a/compiler/test/fail_compilation/imports/b18243.d b/compiler/test/fail_compilation/imports/b18243.d new file mode 100644 index 000000000000..d59128f1f31d --- /dev/null +++ b/compiler/test/fail_compilation/imports/b18243.d @@ -0,0 +1,3 @@ +module imports.b18243; + +bool isNaN(T)(T x) { return false; } diff --git a/compiler/test/fail_compilation/issue11070.d b/compiler/test/fail_compilation/issue11070.d index 07d69ee87ab5..fbba387d686c 100644 --- a/compiler/test/fail_compilation/issue11070.d +++ b/compiler/test/fail_compilation/issue11070.d @@ -1,14 +1,13 @@ /* TEST_OUTPUT: --- -fail_compilation/issue11070.d(16): Error: undefined identifier `x` +fail_compilation/issue11070.d(15): Error: undefined identifier `x` --- */ int get() { return 1; } void test() { - import std.stdio : writeln; switch (auto x = get()) { default: auto z = x; diff --git a/compiler/test/fail_compilation/operator_undefined.d b/compiler/test/fail_compilation/operator_undefined.d index 3065bdb8e79a..94a79cc99843 100644 --- a/compiler/test/fail_compilation/operator_undefined.d +++ b/compiler/test/fail_compilation/operator_undefined.d @@ -1,12 +1,10 @@ /* TEST_OUTPUT: --- -fail_compilation/operator_undefined.d(19): Error: operator `-` is not defined for `toJson(2)` of type `Json` +fail_compilation/operator_undefined.d(17): Error: operator `-` is not defined for `toJson(2)` of type `Json` --- */ -import std.stdio; - struct Json { //int opUnary(string op : "-")(); diff --git a/compiler/test/run.d b/compiler/test/run.d index 279db4d37482..eaf5edf5502a 100755 --- a/compiler/test/run.d +++ b/compiler/test/run.d @@ -18,7 +18,7 @@ import std.algorithm, std.conv, std.datetime, std.exception, std.file, std.forma import tools.paths; const scriptDir = __FILE_FULL_PATH__.dirName.buildNormalizedPath; -immutable testDirs = ["runnable", "runnable_cxx", "dshell", "compilable", "fail_compilation"]; +immutable testDirs = ["runnable", "runnable_cxx", /*"dshell",*/ "compilable", "fail_compilation"]; shared bool verbose; // output verbose logging shared bool force; // always run all tests (ignores timestamp checking) shared string hostDMD; // path to host DMD binary (used for building the tools) @@ -55,7 +55,7 @@ enum TestTool testRunnerUnittests = { name: "d_do_test-ut", extraArgs: testRunner.extraArgs ~ ["-g", "-unittest"], runAfterBuild: true }; enum TestTool jsonSanitizer = { name: "sanitize_json" }; -enum TestTool dshellPrebuilt = { name: "dshell_prebuilt", linksWithTests: true }; +//enum TestTool dshellPrebuilt = { name: "dshell_prebuilt", linksWithTests: true }; immutable struct TestTool { @@ -153,7 +153,7 @@ Options: return spawnProcess(unitTestRunnerCommand ~ args, env, Config.none, scriptDir).wait(); } - ensureToolsExists(env, unitTestRunner, testRunner, testRunnerUnittests, jsonSanitizer, dshellPrebuilt); + ensureToolsExists(env, unitTestRunner, testRunner, testRunnerUnittests, jsonSanitizer/*, dshellPrebuilt*/); if (args == ["tools"]) return 0; @@ -539,7 +539,8 @@ string[string] getEnvironment() env["DMD"] = dmdPath; env.setDefault("DMD_TEST_COVERAGE", "0"); - const generatedSuffix = "generated/%s/%s/%s".format(os, build, model); + const druntimePath = environment.get("DRUNTIME_PATH", projectRootDir.buildPath("druntime")); + const druntimeLibDir = generatedDir.buildPath(os, build, model); version(Windows) { @@ -547,10 +548,8 @@ string[string] getEnvironment() env["OBJ"] = ".obj"; env["DSEP"] = `\\`; env["SEP"] = `\`; - auto druntimePath = environment.get("DRUNTIME_PATH", testPath(`..\..\druntime`)); - auto phobosPath = environment.get("PHOBOS_PATH", testPath(`..\..\..\phobos`)); - env["DFLAGS"] = `-I"%s\import" -I"%s"`.format(druntimePath, phobosPath); - env["LIB"] = phobosPath ~ ";" ~ environment.get("LIB"); + env["DFLAGS"] = `-conf= -I"%s\import" -defaultlib=druntime.lib`.format(druntimePath); + env["LIB"] = druntimeLibDir ~ ";" ~ environment.get("LIB"); } else { @@ -558,8 +557,6 @@ string[string] getEnvironment() env["OBJ"] = ".o"; env["DSEP"] = "/"; env["SEP"] = "/"; - auto druntimePath = environment.get("DRUNTIME_PATH", testPath(`../../druntime`)); - auto phobosPath = environment.get("PHOBOS_PATH", testPath(`../../../phobos`)); // default to PIC, use PIC=1/0 to en-/disable PIC. // Note that shared libraries and C files are always compiled with PIC. @@ -568,11 +565,14 @@ string[string] getEnvironment() pic = false; env["PIC_FLAG"] = pic ? "-fPIC" : ""; - env["DFLAGS"] = "-I%s/import -I%s".format(druntimePath, phobosPath) - ~ " -L-L%s/%s".format(phobosPath, generatedSuffix); - bool isShared = environment.get("SHARED") != "0" && os.among("linux", "freebsd") > 0; + + const isShared = environment.get("SHARED") != "0" && os.among("linux", "freebsd") > 0; + const defaultLib = os == "osx" ? "druntime" : "libdruntime." ~ (isShared ? "so" : "a"); + + env["DFLAGS"] = "-conf= -I%s/import -defaultlib=%s".format(druntimePath, defaultLib) + ~ " -L-L" ~ druntimeLibDir; if (isShared) - env["DFLAGS"] = env["DFLAGS"] ~ " -defaultlib=libphobos2.so -L-rpath=%s/%s".format(phobosPath, generatedSuffix); + env["DFLAGS"] = env["DFLAGS"] ~ " -L-rpath=" ~ druntimeLibDir; if (pic) env["REQUIRED_ARGS"] = environment.get("REQUIRED_ARGS") ~ " " ~ env["PIC_FLAG"]; diff --git a/compiler/test/runnable/arrayop.d b/compiler/test/runnable/arrayop.d index 4c0836a96dc8..11bf910846a5 100644 --- a/compiler/test/runnable/arrayop.d +++ b/compiler/test/runnable/arrayop.d @@ -1,5 +1,4 @@ // RUNNABLE_PHOBOS_TEST -import std.math; extern(C) int printf(const char*, ...); diff --git a/compiler/test/runnable/dhry.d b/compiler/test/runnable/dhry.d index 4d2e1b3c644a..6494210b4e2b 100644 --- a/compiler/test/runnable/dhry.d +++ b/compiler/test/runnable/dhry.d @@ -343,7 +343,6 @@ Deprecation caused by https://issues.dlang.org/show_bug.cgi?id=20645 import core.stdc.stdio; import core.stdc.string; import core.stdc.stdlib; -import std.string; /* Compiler and system dependent definitions: */ diff --git a/compiler/test/runnable/extra-files/importc_main.d b/compiler/test/runnable/extra-files/importc_main.d index 2b36d3b09aba..ef1d18cad4c1 100644 --- a/compiler/test/runnable/extra-files/importc_main.d +++ b/compiler/test/runnable/extra-files/importc_main.d @@ -1,11 +1,11 @@ -import std.stdio; +import core.stdc.stdio; import importc_test; int main() { auto rc = someCodeInC(3, 4); - writeln("Result of someCodeInC(3,4) = ", rc ); + printf("Result of someCodeInC(3,4) = %d\n", rc); assert( rc == 7, "Wrong result"); return 0; } diff --git a/compiler/test/runnable/extra-files/importc_main2.d b/compiler/test/runnable/extra-files/importc_main2.d index 598d0f936d8b..f534840d7e3c 100644 --- a/compiler/test/runnable/extra-files/importc_main2.d +++ b/compiler/test/runnable/extra-files/importc_main2.d @@ -1,5 +1,4 @@ -import std.stdio; import importc_test; int main() diff --git a/compiler/test/runnable/test18076.sh b/compiler/test/runnable/test18076.sh index f4622e5658fb..a8cf27aa9a0f 100755 --- a/compiler/test/runnable/test18076.sh +++ b/compiler/test/runnable/test18076.sh @@ -2,7 +2,7 @@ output_file=${OUTPUT_BASE}.log -echo 'import std.stdio; void main() { writeln("Success"); }' | \ +echo 'import core.stdc.stdio; void main() { puts("Success"); }' | \ $DMD -m${MODEL} -run - > ${output_file} grep -q 'Success' ${output_file} diff --git a/compiler/test/runnable/test19.d b/compiler/test/runnable/test19.d index eda6172abc04..d0d4db1d8188 100644 --- a/compiler/test/runnable/test19.d +++ b/compiler/test/runnable/test19.d @@ -1,7 +1,5 @@ // REQUIRED_ARGS: -unittest -import std.algorithm: cmp; - extern(C) int printf(const char*, ...); /* ================================ */ @@ -269,7 +267,7 @@ void test13() s1 = s1.dup; s2 = tolower13(s1); - assert(cmp(s2, "fol") == 0); + assert(s2 == "fol"); assert(s2 == s1); } diff --git a/compiler/test/runnable/test8544.d b/compiler/test/runnable/test8544.d index 0b8b86bd99fc..6d92270e834a 100644 --- a/compiler/test/runnable/test8544.d +++ b/compiler/test/runnable/test8544.d @@ -1,7 +1,6 @@ // EXECUTE_ARGS: foo bar doo // PERMUTE_ARGS: -import core.stdc.stdio; -import std.conv; +import core.stdc.string : strlen; import core.runtime; void main(string[] args) @@ -12,6 +11,7 @@ void main(string[] args) assert(dArgs.length && cArgs.argc); // ensure we've passed some args assert(dArgs.length == cArgs.argc); - assert(dArgs[1] == to!string(cArgs.argv[1])); - assert(args[1] == to!string(cArgs.argv[1])); + const cArg = cArgs.argv[1][0 .. strlen(cArgs.argv[1])]; + assert(dArgs[1] == cArg); + assert(args[1] == cArg); } diff --git a/compiler/test/runnable/test9287.sh b/compiler/test/runnable/test9287.sh index bcee882c2c35..245690ad0653 100755 --- a/compiler/test/runnable/test9287.sh +++ b/compiler/test/runnable/test9287.sh @@ -2,7 +2,7 @@ set -e -echo 'import std.stdio; void main() { writeln("Success"); }' | \ +echo 'import core.stdc.stdio; void main() { puts("Success"); }' | \ $DMD -m${MODEL} -of${OUTPUT_BASE}${EXE} - ${OUTPUT_BASE}${EXE}