| author | |
| committer | |
| log | 35c1d8cefc3a77b867ecc2da999162781099b4c6 |
| tree | 572620e3af2d8254f74fdd7086eab1e851148084 |
| parent | 989cd4233e14d592c19d458fee24ff0fa9fd9638 |
| parent | 55925b6e259b5453b8af29a5365d82378cb1d54b |
| signature |
significantly increase test coverage31 files changed, 565 insertions(+), 163 deletions(-)
.gitattributes+1| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | *.zig text eol=lf |
| 2 | *.txt text eol=lf | |
| 2 | 3 | langref.html.in text eol=lf |
| 3 | 4 | |
| 4 | 5 | deps/* linguist-vendored |
build.zig+8-6| ... | ... | @@ -70,6 +70,7 @@ pub fn build(b: *Builder) !void { |
| 70 | 70 | const skip_release_fast = b.option(bool, "skip-release-fast", "Main test suite skips release-fast builds") orelse skip_release; |
| 71 | 71 | const skip_release_safe = b.option(bool, "skip-release-safe", "Main test suite skips release-safe builds") orelse skip_release; |
| 72 | 72 | const skip_non_native = b.option(bool, "skip-non-native", "Main test suite skips non-native builds") orelse false; |
| 73 | const skip_libc = b.option(bool, "skip-libc", "Main test suite skips tests that link libc") orelse false; | |
| 73 | 74 | const skip_self_hosted = b.option(bool, "skip-self-hosted", "Main test suite skips building self hosted compiler") orelse false; |
| 74 | 75 | if (!skip_self_hosted) { |
| 75 | 76 | // TODO re-enable this after https://github.com/ziglang/zig/issues/2377 |
| ... | ... | @@ -96,6 +97,10 @@ pub fn build(b: *Builder) !void { |
| 96 | 97 | |
| 97 | 98 | const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter"); |
| 98 | 99 | |
| 100 | const is_wine_enabled = b.option(bool, "enable-wine", "Use Wine to run cross compiled Windows tests") orelse false; | |
| 101 | const is_qemu_enabled = b.option(bool, "enable-qemu", "Use QEMU to run cross compiled foreign architecture tests") orelse false; | |
| 102 | const glibc_multi_dir = b.option([]const u8, "enable-foreign-glibc", "Provide directory with glibc installations to run cross compiled tests that link glibc"); | |
| 103 | ||
| 99 | 104 | const test_stage2_step = b.step("test-stage2", "Run the stage2 compiler tests"); |
| 100 | 105 | test_stage2_step.dependOn(&test_stage2.step); |
| 101 | 106 | |
| ... | ... | @@ -122,19 +127,16 @@ pub fn build(b: *Builder) !void { |
| 122 | 127 | } |
| 123 | 128 | const modes = chosen_modes[0..chosen_mode_index]; |
| 124 | 129 | |
| 125 | const multi_and_single = [_]bool{ false, true }; | |
| 126 | const just_multi = [_]bool{false}; | |
| 127 | ||
| 128 | 130 | // run stage1 `zig fmt` on this build.zig file just to make sure it works |
| 129 | 131 | test_step.dependOn(&fmt_build_zig.step); |
| 130 | 132 | const fmt_step = b.step("test-fmt", "Run zig fmt against build.zig to make sure it works"); |
| 131 | 133 | fmt_step.dependOn(&fmt_build_zig.step); |
| 132 | 134 | |
| 133 | test_step.dependOn(tests.addPkgTests(b, test_filter, "test/stage1/behavior.zig", "behavior", "Run the behavior tests", modes, multi_and_single, skip_non_native)); | |
| 135 | test_step.dependOn(tests.addPkgTests(b, test_filter, "test/stage1/behavior.zig", "behavior", "Run the behavior tests", modes, false, skip_non_native, skip_libc, is_wine_enabled, is_qemu_enabled, glibc_multi_dir)); | |
| 134 | 136 | |
| 135 | test_step.dependOn(tests.addPkgTests(b, test_filter, "std/std.zig", "std", "Run the standard library tests", modes, multi_and_single, skip_non_native)); | |
| 137 | test_step.dependOn(tests.addPkgTests(b, test_filter, "std/std.zig", "std", "Run the standard library tests", modes, false, skip_non_native, skip_libc, is_wine_enabled, is_qemu_enabled, glibc_multi_dir)); | |
| 136 | 138 | |
| 137 | test_step.dependOn(tests.addPkgTests(b, test_filter, "std/special/compiler_rt.zig", "compiler-rt", "Run the compiler_rt tests", modes, just_multi, skip_non_native)); | |
| 139 | test_step.dependOn(tests.addPkgTests(b, test_filter, "std/special/compiler_rt.zig", "compiler-rt", "Run the compiler_rt tests", modes, true, skip_non_native, true, is_wine_enabled, is_qemu_enabled, glibc_multi_dir)); | |
| 138 | 140 | |
| 139 | 141 | test_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes)); |
| 140 | 142 | test_step.dependOn(tests.addStandaloneTests(b, test_filter, modes)); |
ci/azure/linux_script+2-2| ... | ... | @@ -12,7 +12,7 @@ sudo apt-get update -q |
| 12 | 12 | |
| 13 | 13 | sudo apt-get remove -y llvm-* |
| 14 | 14 | sudo rm -rf /usr/local/* |
| 15 | sudo apt-get install -y libxml2-dev libclang-9-dev llvm-9 llvm-9-dev cmake s3cmd gcc-7 g++-7 | |
| 15 | sudo apt-get install -y libxml2-dev libclang-9-dev llvm-9 llvm-9-dev cmake s3cmd gcc-7 g++-7 qemu | |
| 16 | 16 | |
| 17 | 17 | export CC=gcc-7 |
| 18 | 18 | export CXX=g++-7 |
| ... | ... | @@ -20,7 +20,7 @@ mkdir build |
| 20 | 20 | cd build |
| 21 | 21 | cmake .. -DCMAKE_BUILD_TYPE=Release |
| 22 | 22 | make -j2 install |
| 23 | ./zig build --build-file ../build.zig test | |
| 23 | ./zig build test -Denable-qemu | |
| 24 | 24 | |
| 25 | 25 | if [ "${BUILD_REASON}" != "PullRequest" ]; then |
| 26 | 26 | ARTIFACTSDIR="$BUILDDIR/artifacts" |
ci/azure/macos_script+1-1| ... | ... | @@ -70,7 +70,7 @@ mkdir build |
| 70 | 70 | cd build |
| 71 | 71 | cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$(pwd)/release -DZIG_STATIC=ON |
| 72 | 72 | make $JOBS install |
| 73 | release/bin/zig build --build-file ../build.zig test | |
| 73 | release/bin/zig build test | |
| 74 | 74 | |
| 75 | 75 | if [ "${BUILD_REASON}" != "PullRequest" ]; then |
| 76 | 76 | mv ../LICENSE release/ |
ci/azure/pipelines.yml+1-1| ... | ... | @@ -27,7 +27,7 @@ jobs: |
| 27 | 27 | displayName: 'Build and test' |
| 28 | 28 | - job: BuildWindows |
| 29 | 29 | pool: |
| 30 | vmImage: 'vs2017-win2016' | |
| 30 | vmImage: 'windows-2019' | |
| 31 | 31 | |
| 32 | 32 | timeoutInMinutes: 360 |
| 33 | 33 |
ci/azure/windows_script.bat+6-5| ... | ... | @@ -10,17 +10,18 @@ SET "PATH=%PREVPATH%" |
| 10 | 10 | SET "MSYSTEM=%PREVMSYSTEM%" |
| 11 | 11 | |
| 12 | 12 | SET "ZIGBUILDDIR=%SRCROOT%\build" |
| 13 | SET "ZIGINSTALLDIR=%ZIGBUILDDIR%\release" | |
| 13 | SET "ZIGINSTALLDIR=%ZIGBUILDDIR%\dist" | |
| 14 | 14 | SET "ZIGPREFIXPATH=%SRCROOT%\llvm+clang-9.0.0-win64-msvc-release" |
| 15 | 15 | |
| 16 | call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 | |
| 16 | call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 | |
| 17 | 17 | |
| 18 | 18 | mkdir %ZIGBUILDDIR% |
| 19 | 19 | cd %ZIGBUILDDIR% |
| 20 | cmake.exe .. -Thost=x64 -G"Visual Studio 15 2017 Win64" "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release || exit /b | |
| 21 | msbuild /p:Configuration=Release INSTALL.vcxproj || exit /b | |
| 20 | REM Here we use MinSizeRel instead of Release to work around https://github.com/ziglang/zig/issues/3024 | |
| 21 | cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=MinSizeRel || exit /b | |
| 22 | msbuild /p:Configuration=MinSizeRel INSTALL.vcxproj || exit /b | |
| 22 | 23 | |
| 23 | "%ZIGINSTALLDIR%\bin\zig.exe" build --build-file ..\build.zig test || exit /b | |
| 24 | "%ZIGINSTALLDIR%\bin\zig.exe" build test || exit /b | |
| 24 | 25 | |
| 25 | 26 | set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" |
| 26 | 27 | SET "MSYSTEM=MINGW64" |
ci/azure/windows_upload+6-7| ... | ... | @@ -6,16 +6,15 @@ set -e |
| 6 | 6 | if [ "${BUILD_REASON}" != "PullRequest" ]; then |
| 7 | 7 | cd "$ZIGBUILDDIR" |
| 8 | 8 | |
| 9 | rm release/*.exe | |
| 10 | mv ../LICENSE release/ | |
| 11 | mv ../zig-cache/langref.html release/ | |
| 12 | mv release/bin/zig.exe release/ | |
| 13 | rmdir release/bin | |
| 9 | mv ../LICENSE dist/ | |
| 10 | mv ../zig-cache/langref.html dist/ | |
| 11 | mv dist/bin/zig.exe dist/ | |
| 12 | rmdir dist/bin | |
| 14 | 13 | |
| 15 | VERSION=$(release/zig.exe version) | |
| 14 | VERSION=$(dist/zig.exe version) | |
| 16 | 15 | DIRNAME="zig-windows-x86_64-$VERSION" |
| 17 | 16 | TARBALL="$DIRNAME.zip" |
| 18 | mv release "$DIRNAME" | |
| 17 | mv dist "$DIRNAME" | |
| 19 | 18 | 7z a "$TARBALL" "$DIRNAME" |
| 20 | 19 | |
| 21 | 20 | mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg" |
lib/libc/include/any-windows-any/psdk_inc/intrin-impl.h-26| ... | ... | @@ -1938,32 +1938,6 @@ __buildmov(__movsd, unsigned __LONG32, "d") |
| 1938 | 1938 | #define __INTRINSIC_DEFINED___movsd |
| 1939 | 1939 | #endif /* __INTRINSIC_PROLOG */ |
| 1940 | 1940 | |
| 1941 | #if !defined(__GNUC__) || __GNUC__ < 8 /* GCC 8 has already defined _xgetbv */ | |
| 1942 | /* NOTE: This should be in immintrin.h */ | |
| 1943 | #if __INTRINSIC_PROLOG(_xgetbv) | |
| 1944 | unsigned __int64 _xgetbv(unsigned int); | |
| 1945 | #if !__has_builtin(_xgetbv) | |
| 1946 | __INTRINSICS_USEINLINE | |
| 1947 | unsigned __int64 _xgetbv(unsigned int index) | |
| 1948 | { | |
| 1949 | #if defined(__x86_64__) || defined(_AMD64_) | |
| 1950 | unsigned __int64 val1, val2; | |
| 1951 | #else | |
| 1952 | unsigned __LONG32 val1, val2; | |
| 1953 | #endif /* defined(__x86_64__) || defined(_AMD64_) */ | |
| 1954 | ||
| 1955 | __asm__ __volatile__( | |
| 1956 | "xgetbv" | |
| 1957 | : "=a" (val1), "=d" (val2) | |
| 1958 | : "c" (index)); | |
| 1959 | ||
| 1960 | return (((unsigned __int64)val2) << 32) | val1; | |
| 1961 | } | |
| 1962 | #endif | |
| 1963 | #define __INTRINSIC_DEFINED__xgetbv | |
| 1964 | #endif /* __INTRINSIC_PROLOG */ | |
| 1965 | #endif /* __GNUC__ < 8 */ | |
| 1966 | ||
| 1967 | 1941 | #endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_) */ |
| 1968 | 1942 | |
| 1969 | 1943 | /* ***************************************************** */ |
src/buffer.cpp-1| ... | ... | @@ -61,7 +61,6 @@ void buf_appendf(Buf *buf, const char *format, ...) { |
| 61 | 61 | |
| 62 | 62 | // these functions are not static inline so they can be better used as template parameters |
| 63 | 63 | bool buf_eql_buf(Buf *buf, Buf *other) { |
| 64 | assert(buf->list.length); | |
| 65 | 64 | return buf_eql_mem(buf, buf_ptr(other), buf_len(other)); |
| 66 | 65 | } |
| 67 | 66 |
src/glibc.cpp+22-7| ... | ... | @@ -50,7 +50,7 @@ Error glibc_load_metadata(ZigGLibCAbi **out_result, Buf *zig_lib_dir, bool verbo |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | { |
| 53 | SplitIterator it = memSplit(buf_to_slice(vers_txt_contents), str("\n")); | |
| 53 | SplitIterator it = memSplit(buf_to_slice(vers_txt_contents), str("\r\n")); | |
| 54 | 54 | for (;;) { |
| 55 | 55 | Optional<Slice<uint8_t>> opt_component = SplitIterator_next(&it); |
| 56 | 56 | if (!opt_component.is_some) break; |
| ... | ... | @@ -65,7 +65,7 @@ Error glibc_load_metadata(ZigGLibCAbi **out_result, Buf *zig_lib_dir, bool verbo |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | { |
| 68 | SplitIterator it = memSplit(buf_to_slice(fns_txt_contents), str("\n")); | |
| 68 | SplitIterator it = memSplit(buf_to_slice(fns_txt_contents), str("\r\n")); | |
| 69 | 69 | for (;;) { |
| 70 | 70 | Optional<Slice<uint8_t>> opt_component = SplitIterator_next(&it); |
| 71 | 71 | if (!opt_component.is_some) break; |
| ... | ... | @@ -91,17 +91,19 @@ Error glibc_load_metadata(ZigGLibCAbi **out_result, Buf *zig_lib_dir, bool verbo |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | { |
| 94 | SplitIterator it = memSplit(buf_to_slice(abi_txt_contents), str("\n")); | |
| 94 | SplitIterator it = memSplit(buf_to_slice(abi_txt_contents), str("\r\n")); | |
| 95 | 95 | ZigGLibCVerList *ver_list_base = nullptr; |
| 96 | int line_num = 0; | |
| 96 | 97 | for (;;) { |
| 97 | 98 | if (ver_list_base == nullptr) { |
| 99 | line_num += 1; | |
| 98 | 100 | Optional<Slice<uint8_t>> opt_line = SplitIterator_next_separate(&it); |
| 99 | 101 | if (!opt_line.is_some) break; |
| 100 | 102 | |
| 101 | 103 | ver_list_base = allocate<ZigGLibCVerList>(glibc_abi->all_functions.length); |
| 102 | ZigTarget *target = allocate<ZigTarget>(1); | |
| 103 | 104 | SplitIterator line_it = memSplit(opt_line.value, str(" ")); |
| 104 | 105 | for (;;) { |
| 106 | ZigTarget *target = allocate<ZigTarget>(1); | |
| 105 | 107 | Optional<Slice<uint8_t>> opt_target = SplitIterator_next(&line_it); |
| 106 | 108 | if (!opt_target.is_some) break; |
| 107 | 109 | |
| ... | ... | @@ -122,7 +124,19 @@ Error glibc_load_metadata(ZigGLibCAbi **out_result, Buf *zig_lib_dir, bool verbo |
| 122 | 124 | target->os = OsLinux; |
| 123 | 125 | |
| 124 | 126 | err = target_parse_abi(&target->abi, (char*)opt_abi.value.ptr, opt_abi.value.len); |
| 125 | assert(err == ErrorNone); | |
| 127 | if (err != ErrorNone) { | |
| 128 | fprintf(stderr, "Error parsing %s:%d: %s\n", buf_ptr(glibc_abi->abi_txt_path), | |
| 129 | line_num, err_str(err)); | |
| 130 | fprintf(stderr, "arch: '%.*s', os: '%.*s', abi: '%.*s'\n", | |
| 131 | (int)opt_arch.value.len, (const char*)opt_arch.value.ptr, | |
| 132 | (int)opt_os.value.len, (const char*)opt_os.value.ptr, | |
| 133 | (int)opt_abi.value.len, (const char*)opt_abi.value.ptr); | |
| 134 | fprintf(stderr, "parsed from target: '%.*s'\n", | |
| 135 | (int)opt_target.value.len, (const char*)opt_target.value.ptr); | |
| 136 | fprintf(stderr, "parsed from line:\n%.*s\n", (int)opt_line.value.len, opt_line.value.ptr); | |
| 137 | fprintf(stderr, "Zig installation appears to be corrupted.\n"); | |
| 138 | exit(1); | |
| 139 | } | |
| 126 | 140 | |
| 127 | 141 | glibc_abi->version_table.put(target, ver_list_base); |
| 128 | 142 | } |
| ... | ... | @@ -130,6 +144,7 @@ Error glibc_load_metadata(ZigGLibCAbi **out_result, Buf *zig_lib_dir, bool verbo |
| 130 | 144 | } |
| 131 | 145 | for (size_t fn_i = 0; fn_i < glibc_abi->all_functions.length; fn_i += 1) { |
| 132 | 146 | ZigGLibCVerList *ver_list = &ver_list_base[fn_i]; |
| 147 | line_num += 1; | |
| 133 | 148 | Optional<Slice<uint8_t>> opt_line = SplitIterator_next_separate(&it); |
| 134 | 149 | assert(opt_line.is_some); |
| 135 | 150 | |
| ... | ... | @@ -266,7 +281,7 @@ Error glibc_build_dummies_and_maps(CodeGen *g, const ZigGLibCAbi *glibc_abi, con |
| 266 | 281 | // - If there are no versions, don't emit it |
| 267 | 282 | // - Take the greatest one <= than the target one |
| 268 | 283 | // - If none of them is <= than the |
| 269 | // specified one don't pick any default version | |
| 284 | // specified one don't pick any default version | |
| 270 | 285 | if (ver_list->len == 0) continue; |
| 271 | 286 | uint8_t chosen_def_ver_index = 255; |
| 272 | 287 | for (uint8_t ver_i = 0; ver_i < ver_list->len; ver_i += 1) { |
| ... | ... | @@ -322,7 +337,7 @@ Error glibc_build_dummies_and_maps(CodeGen *g, const ZigGLibCAbi *glibc_abi, con |
| 322 | 337 | codegen_set_lib_version(child_gen, lib->sover, 0, 0); |
| 323 | 338 | child_gen->is_dynamic = true; |
| 324 | 339 | child_gen->is_dummy_so = true; |
| 325 | child_gen->version_script_path = map_file_path; | |
| 340 | child_gen->version_script_path = map_file_path; | |
| 326 | 341 | child_gen->enable_cache = false; |
| 327 | 342 | child_gen->output_dir = dummy_dir; |
| 328 | 343 | codegen_build_and_link(child_gen); |
src/link.cpp+4| ... | ... | @@ -1295,6 +1295,7 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) { |
| 1295 | 1295 | c_file->args.append("-include"); |
| 1296 | 1296 | c_file->args.append(path_from_libc(parent, "glibc" OS_SEP "include" OS_SEP "libc-modules.h")); |
| 1297 | 1297 | c_file->args.append("-DMODULE_NAME=libc"); |
| 1298 | c_file->args.append("-Wno-nonportable-include-path"); | |
| 1298 | 1299 | c_file->args.append("-include"); |
| 1299 | 1300 | c_file->args.append(path_from_libc(parent, "glibc" OS_SEP "include" OS_SEP "libc-symbols.h")); |
| 1300 | 1301 | c_file->args.append("-DTOP_NAMESPACE=glibc"); |
| ... | ... | @@ -1321,6 +1322,7 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) { |
| 1321 | 1322 | c_file->args.append("-include"); |
| 1322 | 1323 | c_file->args.append(path_from_libc(parent, "glibc" OS_SEP "include" OS_SEP "libc-modules.h")); |
| 1323 | 1324 | c_file->args.append("-DMODULE_NAME=libc"); |
| 1325 | c_file->args.append("-Wno-nonportable-include-path"); | |
| 1324 | 1326 | c_file->args.append("-include"); |
| 1325 | 1327 | c_file->args.append(path_from_libc(parent, "glibc" OS_SEP "include" OS_SEP "libc-symbols.h")); |
| 1326 | 1328 | c_file->args.append("-DPIC"); |
| ... | ... | @@ -1377,6 +1379,7 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) { |
| 1377 | 1379 | c_file->args.append("-include"); |
| 1378 | 1380 | c_file->args.append(path_from_libc(parent, "glibc" OS_SEP "include" OS_SEP "libc-modules.h")); |
| 1379 | 1381 | c_file->args.append("-DMODULE_NAME=libc"); |
| 1382 | c_file->args.append("-Wno-nonportable-include-path"); | |
| 1380 | 1383 | c_file->args.append("-include"); |
| 1381 | 1384 | c_file->args.append(path_from_libc(parent, "glibc" OS_SEP "include" OS_SEP "libc-symbols.h")); |
| 1382 | 1385 | c_file->args.append("-DPIC"); |
| ... | ... | @@ -1420,6 +1423,7 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) { |
| 1420 | 1423 | c_file->args.append("-include"); |
| 1421 | 1424 | c_file->args.append(path_from_libc(parent, "glibc" OS_SEP "include" OS_SEP "libc-modules.h")); |
| 1422 | 1425 | c_file->args.append("-DMODULE_NAME=libc"); |
| 1426 | c_file->args.append("-Wno-nonportable-include-path"); | |
| 1423 | 1427 | c_file->args.append("-include"); |
| 1424 | 1428 | c_file->args.append(path_from_libc(parent, "glibc" OS_SEP "include" OS_SEP "libc-symbols.h")); |
| 1425 | 1429 | c_file->args.append("-DPIC"); |
src/os.cpp+1-1| ... | ... | @@ -116,7 +116,7 @@ static void os_spawn_process_posix(ZigList<const char *> &args, Termination *ter |
| 116 | 116 | pid_t pid; |
| 117 | 117 | int rc = posix_spawnp(&pid, args.at(0), nullptr, nullptr, const_cast<char *const*>(argv), environ); |
| 118 | 118 | if (rc != 0) { |
| 119 | zig_panic("posix_spawn failed: %s", strerror(rc)); | |
| 119 | zig_panic("unable to spawn %s: %s", args.at(0), strerror(rc)); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | int status; |
src/util.cpp+1-8| ... | ... | @@ -18,17 +18,10 @@ void zig_panic(const char *format, ...) { |
| 18 | 18 | vfprintf(stderr, format, ap); |
| 19 | 19 | fflush(stderr); |
| 20 | 20 | va_end(ap); |
| 21 | stage2_panic(nullptr, 0); | |
| 21 | stage2_panic("", 0); | |
| 22 | 22 | abort(); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | void assert(bool ok) { | |
| 26 | if (!ok) { | |
| 27 | const char *msg = "Assertion failed. This is a bug in the Zig compiler."; | |
| 28 | stage2_panic(msg, strlen(msg)); | |
| 29 | } | |
| 30 | } | |
| 31 | ||
| 32 | 25 | uint32_t int_hash(int i) { |
| 33 | 26 | return (uint32_t)(i % UINT32_MAX); |
| 34 | 27 | } |
src/util.hpp+8-2| ... | ... | @@ -43,15 +43,21 @@ ATTRIBUTE_NORETURN |
| 43 | 43 | ATTRIBUTE_PRINTF(1, 2) |
| 44 | 44 | void zig_panic(const char *format, ...); |
| 45 | 45 | |
| 46 | static inline void zig_assert(bool ok, const char *file, int line, const char *func) { | |
| 47 | if (!ok) { | |
| 48 | zig_panic("Assertion failed at %s:%d in %s. This is a bug in the Zig compiler.", file, line, func); | |
| 49 | } | |
| 50 | } | |
| 51 | ||
| 46 | 52 | #ifdef _WIN32 |
| 47 | 53 | #define __func__ __FUNCTION__ |
| 48 | 54 | #endif |
| 49 | 55 | |
| 50 | #define zig_unreachable() zig_panic("unreachable: %s:%s:%d", __FILE__, __func__, __LINE__) | |
| 56 | #define zig_unreachable() zig_panic("Unreachable at %s:%d in %s. This is a bug in the Zig compiler.", __FILE__, __LINE__, __func__) | |
| 51 | 57 | |
| 52 | 58 | // Assertions in stage1 are always on, and they call zig @panic. |
| 53 | 59 | #undef assert |
| 54 | void assert(bool ok); | |
| 60 | #define assert(ok) zig_assert(ok, __FILE__, __LINE__, __func__) | |
| 55 | 61 | |
| 56 | 62 | #if defined(_MSC_VER) |
| 57 | 63 | static inline int clzll(unsigned long long mask) { |
std/build.zig+175-1| ... | ... | @@ -1015,6 +1015,7 @@ pub const Target = union(enum) { |
| 1015 | 1015 | => return .msvc, |
| 1016 | 1016 | .linux, |
| 1017 | 1017 | .wasi, |
| 1018 | .emscripten, | |
| 1018 | 1019 | => return .musl, |
| 1019 | 1020 | } |
| 1020 | 1021 | } |
| ... | ... | @@ -1175,6 +1176,13 @@ pub const Target = union(enum) { |
| 1175 | 1176 | }; |
| 1176 | 1177 | } |
| 1177 | 1178 | |
| 1179 | pub fn isLinux(self: Target) bool { | |
| 1180 | return switch (self.getOs()) { | |
| 1181 | .linux => true, | |
| 1182 | else => false, | |
| 1183 | }; | |
| 1184 | } | |
| 1185 | ||
| 1178 | 1186 | pub fn isUefi(self: Target) bool { |
| 1179 | 1187 | return switch (self.getOs()) { |
| 1180 | 1188 | .uefi => true, |
| ... | ... | @@ -1196,9 +1204,125 @@ pub const Target = union(enum) { |
| 1196 | 1204 | }; |
| 1197 | 1205 | } |
| 1198 | 1206 | |
| 1207 | pub fn isNetBSD(self: Target) bool { | |
| 1208 | return switch (self.getOs()) { | |
| 1209 | .netbsd => true, | |
| 1210 | else => false, | |
| 1211 | }; | |
| 1212 | } | |
| 1213 | ||
| 1199 | 1214 | pub fn wantSharedLibSymLinks(self: Target) bool { |
| 1200 | 1215 | return !self.isWindows(); |
| 1201 | 1216 | } |
| 1217 | ||
| 1218 | pub fn osRequiresLibC(self: Target) bool { | |
| 1219 | return self.isDarwin() or self.isFreeBSD() or self.isNetBSD(); | |
| 1220 | } | |
| 1221 | ||
| 1222 | pub fn getArchPtrBitWidth(self: Target) u32 { | |
| 1223 | switch (self.getArch()) { | |
| 1224 | .avr, | |
| 1225 | .msp430, | |
| 1226 | => return 16, | |
| 1227 | ||
| 1228 | .arc, | |
| 1229 | .arm, | |
| 1230 | .armeb, | |
| 1231 | .hexagon, | |
| 1232 | .le32, | |
| 1233 | .mips, | |
| 1234 | .mipsel, | |
| 1235 | .powerpc, | |
| 1236 | .r600, | |
| 1237 | .riscv32, | |
| 1238 | .sparc, | |
| 1239 | .sparcel, | |
| 1240 | .tce, | |
| 1241 | .tcele, | |
| 1242 | .thumb, | |
| 1243 | .thumbeb, | |
| 1244 | .i386, | |
| 1245 | .xcore, | |
| 1246 | .nvptx, | |
| 1247 | .amdil, | |
| 1248 | .hsail, | |
| 1249 | .spir, | |
| 1250 | .kalimba, | |
| 1251 | .shave, | |
| 1252 | .lanai, | |
| 1253 | .wasm32, | |
| 1254 | .renderscript32, | |
| 1255 | .aarch64_32, | |
| 1256 | => return 32, | |
| 1257 | ||
| 1258 | .aarch64, | |
| 1259 | .aarch64_be, | |
| 1260 | .mips64, | |
| 1261 | .mips64el, | |
| 1262 | .powerpc64, | |
| 1263 | .powerpc64le, | |
| 1264 | .riscv64, | |
| 1265 | .x86_64, | |
| 1266 | .nvptx64, | |
| 1267 | .le64, | |
| 1268 | .amdil64, | |
| 1269 | .hsail64, | |
| 1270 | .spir64, | |
| 1271 | .wasm64, | |
| 1272 | .renderscript64, | |
| 1273 | .amdgcn, | |
| 1274 | .bpfel, | |
| 1275 | .bpfeb, | |
| 1276 | .sparcv9, | |
| 1277 | .s390x, | |
| 1278 | => return 64, | |
| 1279 | } | |
| 1280 | } | |
| 1281 | ||
| 1282 | pub const Executor = union(enum) { | |
| 1283 | native, | |
| 1284 | qemu: []const u8, | |
| 1285 | wine: []const u8, | |
| 1286 | unavailable, | |
| 1287 | }; | |
| 1288 | ||
| 1289 | pub fn getExternalExecutor(self: Target) Executor { | |
| 1290 | if (@TagType(Target)(self) == .Native) return .native; | |
| 1291 | ||
| 1292 | // If the target OS matches the host OS, we can use QEMU to emulate a foreign architecture. | |
| 1293 | if (self.getOs() == builtin.os) { | |
| 1294 | return switch (self.getArch()) { | |
| 1295 | .aarch64 => Executor{ .qemu = "qemu-aarch64" }, | |
| 1296 | .aarch64_be => Executor{ .qemu = "qemu-aarch64_be" }, | |
| 1297 | .arm => Executor{ .qemu = "qemu-arm" }, | |
| 1298 | .armeb => Executor{ .qemu = "qemu-armeb" }, | |
| 1299 | .i386 => Executor{ .qemu = "qemu-i386" }, | |
| 1300 | .mips => Executor{ .qemu = "qemu-mips" }, | |
| 1301 | .mipsel => Executor{ .qemu = "qemu-mipsel" }, | |
| 1302 | .mips64 => Executor{ .qemu = "qemu-mips64" }, | |
| 1303 | .mips64el => Executor{ .qemu = "qemu-mips64el" }, | |
| 1304 | .powerpc => Executor{ .qemu = "qemu-ppc" }, | |
| 1305 | .powerpc64 => Executor{ .qemu = "qemu-ppc64" }, | |
| 1306 | .powerpc64le => Executor{ .qemu = "qemu-ppc64le" }, | |
| 1307 | .riscv32 => Executor{ .qemu = "qemu-riscv32" }, | |
| 1308 | .riscv64 => Executor{ .qemu = "qemu-riscv64" }, | |
| 1309 | .s390x => Executor{ .qemu = "qemu-s390x" }, | |
| 1310 | .sparc => Executor{ .qemu = "qemu-sparc" }, | |
| 1311 | .x86_64 => Executor{ .qemu = "qemu-x86_64" }, | |
| 1312 | else => return .unavailable, | |
| 1313 | }; | |
| 1314 | } | |
| 1315 | ||
| 1316 | if (self.isWindows()) { | |
| 1317 | switch (self.getArchPtrBitWidth()) { | |
| 1318 | 32 => return Executor{ .wine = "wine" }, | |
| 1319 | 64 => return Executor{ .wine = "wine64" }, | |
| 1320 | else => return .unavailable, | |
| 1321 | } | |
| 1322 | } | |
| 1323 | ||
| 1324 | return .unavailable; | |
| 1325 | } | |
| 1202 | 1326 | }; |
| 1203 | 1327 | |
| 1204 | 1328 | const Pkg = struct { |
| ... | ... | @@ -1266,6 +1390,7 @@ pub const LibExeObjStep = struct { |
| 1266 | 1390 | include_dirs: ArrayList(IncludeDir), |
| 1267 | 1391 | output_dir: ?[]const u8, |
| 1268 | 1392 | need_system_paths: bool, |
| 1393 | is_linking_libc: bool = false, | |
| 1269 | 1394 | |
| 1270 | 1395 | installed_path: ?[]const u8, |
| 1271 | 1396 | install_step: ?*InstallArtifactStep, |
| ... | ... | @@ -1275,6 +1400,20 @@ pub const LibExeObjStep = struct { |
| 1275 | 1400 | |
| 1276 | 1401 | valgrind_support: ?bool = null, |
| 1277 | 1402 | |
| 1403 | /// Uses system Wine installation to run cross compiled Windows build artifacts. | |
| 1404 | enable_wine: bool = false, | |
| 1405 | ||
| 1406 | /// Uses system QEMU installation to run cross compiled foreign architecture build artifacts. | |
| 1407 | enable_qemu: bool = false, | |
| 1408 | ||
| 1409 | /// After following the steps in https://github.com/ziglang/zig/wiki/Updating-libc#glibc, | |
| 1410 | /// this will be the directory $glibc-build-dir/install/glibcs | |
| 1411 | /// Given the example of the aarch64 target, this is the directory | |
| 1412 | /// that contains the path `aarch64-linux-gnu/lib/ld-linux-aarch64.so.1`. | |
| 1413 | glibc_multi_install_dir: ?[]const u8 = null, | |
| 1414 | ||
| 1415 | dynamic_linker: ?[]const u8 = null, | |
| 1416 | ||
| 1278 | 1417 | const LinkObject = union(enum) { |
| 1279 | 1418 | StaticPath: []const u8, |
| 1280 | 1419 | OtherStep: *LibExeObjStep, |
| ... | ... | @@ -1504,7 +1643,9 @@ pub const LibExeObjStep = struct { |
| 1504 | 1643 | |
| 1505 | 1644 | pub fn linkSystemLibrary(self: *LibExeObjStep, name: []const u8) void { |
| 1506 | 1645 | self.link_objects.append(LinkObject{ .SystemLib = self.builder.dupe(name) }) catch unreachable; |
| 1507 | if (!isLibCLibrary(name)) { | |
| 1646 | if (isLibCLibrary(name)) { | |
| 1647 | self.is_linking_libc = true; | |
| 1648 | } else { | |
| 1508 | 1649 | self.need_system_paths = true; |
| 1509 | 1650 | } |
| 1510 | 1651 | } |
| ... | ... | @@ -1840,6 +1981,11 @@ pub const LibExeObjStep = struct { |
| 1840 | 1981 | zig_args.append(builder.pathFromRoot(linker_script)) catch unreachable; |
| 1841 | 1982 | } |
| 1842 | 1983 | |
| 1984 | if (self.dynamic_linker) |dynamic_linker| { | |
| 1985 | try zig_args.append("--dynamic-linker"); | |
| 1986 | try zig_args.append(dynamic_linker); | |
| 1987 | } | |
| 1988 | ||
| 1843 | 1989 | if (self.version_script) |version_script| { |
| 1844 | 1990 | try zig_args.append("--version-script"); |
| 1845 | 1991 | try zig_args.append(builder.pathFromRoot(version_script)); |
| ... | ... | @@ -1854,6 +2000,34 @@ pub const LibExeObjStep = struct { |
| 1854 | 2000 | try zig_args.append("--test-cmd-bin"); |
| 1855 | 2001 | } |
| 1856 | 2002 | } |
| 2003 | } else switch (self.target.getExternalExecutor()) { | |
| 2004 | .native, .unavailable => {}, | |
| 2005 | .qemu => |bin_name| if (self.enable_qemu) qemu: { | |
| 2006 | const need_cross_glibc = self.target.isGnu() and self.target.isLinux() and self.is_linking_libc; | |
| 2007 | const glibc_dir_arg = if (need_cross_glibc) | |
| 2008 | self.glibc_multi_install_dir orelse break :qemu | |
| 2009 | else | |
| 2010 | null; | |
| 2011 | try zig_args.append("--test-cmd"); | |
| 2012 | try zig_args.append(bin_name); | |
| 2013 | if (glibc_dir_arg) |dir| { | |
| 2014 | const full_dir = try fs.path.join(builder.allocator, [_][]const u8{ | |
| 2015 | dir, | |
| 2016 | try self.target.linuxTriple(builder.allocator), | |
| 2017 | }); | |
| 2018 | ||
| 2019 | try zig_args.append("--test-cmd"); | |
| 2020 | try zig_args.append("-L"); | |
| 2021 | try zig_args.append("--test-cmd"); | |
| 2022 | try zig_args.append(full_dir); | |
| 2023 | } | |
| 2024 | try zig_args.append("--test-cmd-bin"); | |
| 2025 | }, | |
| 2026 | .wine => |bin_name| if (self.enable_wine) { | |
| 2027 | try zig_args.append("--test-cmd"); | |
| 2028 | try zig_args.append(bin_name); | |
| 2029 | try zig_args.append("--test-cmd-bin"); | |
| 2030 | }, | |
| 1857 | 2031 | } |
| 1858 | 2032 | for (self.packages.toSliceConst()) |pkg| { |
| 1859 | 2033 | zig_args.append("--pkg-begin") catch unreachable; |
std/c.zig+1-1| ... | ... | @@ -63,7 +63,7 @@ pub extern "c" fn close(fd: fd_t) c_int; |
| 63 | 63 | pub extern "c" fn @"close$NOCANCEL"(fd: fd_t) c_int; |
| 64 | 64 | pub extern "c" fn fstat(fd: fd_t, buf: *Stat) c_int; |
| 65 | 65 | pub extern "c" fn @"fstat$INODE64"(fd: fd_t, buf: *Stat) c_int; |
| 66 | pub extern "c" fn lseek(fd: fd_t, offset: isize, whence: c_int) isize; | |
| 66 | pub extern "c" fn lseek(fd: fd_t, offset: off_t, whence: c_int) off_t; | |
| 67 | 67 | pub extern "c" fn open(path: [*]const u8, oflag: c_uint, ...) c_int; |
| 68 | 68 | pub extern "c" fn openat(fd: c_int, path: [*]const u8, oflag: c_uint, ...) c_int; |
| 69 | 69 | pub extern "c" fn raise(sig: c_int) c_int; |
std/fmt/parse_float.zig+4| ... | ... | @@ -382,6 +382,10 @@ pub fn parseFloat(comptime T: type, s: []const u8) !T { |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | test "fmt.parseFloat" { |
| 385 | if (@import("builtin").arch == .arm) { | |
| 386 | // TODO https://github.com/ziglang/zig/issues/3289 | |
| 387 | return error.SkipZigTest; | |
| 388 | } | |
| 385 | 389 | const testing = std.testing; |
| 386 | 390 | const expect = testing.expect; |
| 387 | 391 | const expectEqual = testing.expectEqual; |
std/fs/path.zig+8| ... | ... | @@ -646,6 +646,10 @@ test "resolve" { |
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | test "resolveWindows" { |
| 649 | if (@import("builtin").arch == .aarch64) { | |
| 650 | // TODO https://github.com/ziglang/zig/issues/3288 | |
| 651 | return error.SkipZigTest; | |
| 652 | } | |
| 649 | 653 | if (windows.is_the_target) { |
| 650 | 654 | const cwd = try process.getCwdAlloc(debug.global_allocator); |
| 651 | 655 | const parsed_cwd = windowsParsePath(cwd); |
| ... | ... | @@ -1086,6 +1090,10 @@ pub fn relativePosix(allocator: *Allocator, from: []const u8, to: []const u8) ![ |
| 1086 | 1090 | } |
| 1087 | 1091 | |
| 1088 | 1092 | test "relative" { |
| 1093 | if (@import("builtin").arch == .aarch64) { | |
| 1094 | // TODO https://github.com/ziglang/zig/issues/3288 | |
| 1095 | return error.SkipZigTest; | |
| 1096 | } | |
| 1089 | 1097 | testRelativeWindows("c:/blah\\blah", "d:/games", "D:\\games"); |
| 1090 | 1098 | testRelativeWindows("c:/aaaa/bbbb", "c:/aaaa", ".."); |
| 1091 | 1099 | testRelativeWindows("c:/aaaa/bbbb", "c:/cccc", "..\\..\\cccc"); |
std/io/test.zig+4| ... | ... | @@ -11,6 +11,10 @@ const fs = std.fs; |
| 11 | 11 | const File = std.fs.File; |
| 12 | 12 | |
| 13 | 13 | test "write a file, read it, then delete it" { |
| 14 | if (builtin.arch == .aarch64 and builtin.glibc_version != null) { | |
| 15 | // TODO https://github.com/ziglang/zig/issues/3288 | |
| 16 | return error.SkipZigTest; | |
| 17 | } | |
| 14 | 18 | var raw_bytes: [200 * 1024]u8 = undefined; |
| 15 | 19 | var allocator = &std.heap.FixedBufferAllocator.init(raw_bytes[0..]).allocator; |
| 16 | 20 |
std/os/bits/darwin.zig+3-1| ... | ... | @@ -43,6 +43,8 @@ pub const mach_timebase_info_data = extern struct { |
| 43 | 43 | denom: u32, |
| 44 | 44 | }; |
| 45 | 45 | |
| 46 | pub const off_t = i64; | |
| 47 | ||
| 46 | 48 | /// Renamed to Stat to not conflict with the stat function. |
| 47 | 49 | /// atime, mtime, and ctime have functions to return `timespec`, |
| 48 | 50 | /// because although this is a POSIX API, the layout and names of |
| ... | ... | @@ -65,7 +67,7 @@ pub const Stat = extern struct { |
| 65 | 67 | ctimensec: isize, |
| 66 | 68 | birthtimesec: isize, |
| 67 | 69 | birthtimensec: isize, |
| 68 | size: i64, | |
| 70 | size: off_t, | |
| 69 | 71 | blocks: i64, |
| 70 | 72 | blksize: i32, |
| 71 | 73 | flags: u32, |
std/os/bits/freebsd.zig+3-1| ... | ... | @@ -73,6 +73,8 @@ pub const msghdr_const = extern struct { |
| 73 | 73 | msg_flags: i32, |
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | pub const off_t = i64; | |
| 77 | ||
| 76 | 78 | /// Renamed to Stat to not conflict with the stat function. |
| 77 | 79 | /// atime, mtime, and ctime have functions to return `timespec`, |
| 78 | 80 | /// because although this is a POSIX API, the layout and names of |
| ... | ... | @@ -96,7 +98,7 @@ pub const Stat = extern struct { |
| 96 | 98 | ctim: timespec, |
| 97 | 99 | birthtim: timespec, |
| 98 | 100 | |
| 99 | size: i64, | |
| 101 | size: off_t, | |
| 100 | 102 | blocks: i64, |
| 101 | 103 | blksize: isize, |
| 102 | 104 | flags: u32, |
std/os/bits/linux/arm-eabi.zig+3-1| ... | ... | @@ -511,6 +511,8 @@ pub const msghdr_const = extern struct { |
| 511 | 511 | msg_flags: i32, |
| 512 | 512 | }; |
| 513 | 513 | |
| 514 | pub const off_t = i64; | |
| 515 | ||
| 514 | 516 | /// Renamed to Stat to not conflict with the stat function. |
| 515 | 517 | /// atime, mtime, and ctime have functions to return `timespec`, |
| 516 | 518 | /// because although this is a POSIX API, the layout and names of |
| ... | ... | @@ -527,7 +529,7 @@ pub const Stat = extern struct { |
| 527 | 529 | gid: u32, |
| 528 | 530 | rdev: u64, |
| 529 | 531 | __rdev_padding: u32, |
| 530 | size: i64, | |
| 532 | size: off_t, | |
| 531 | 533 | blksize: i32, |
| 532 | 534 | blocks: u64, |
| 533 | 535 | atim: timespec, |
std/os/bits/linux/arm64.zig+26-16| ... | ... | @@ -1,11 +1,13 @@ |
| 1 | 1 | // arm64-specific declarations that are intended to be imported into the POSIX namespace. |
| 2 | 2 | // This does include Linux-only APIs. |
| 3 | 3 | |
| 4 | const std = @import("../../std.zig"); | |
| 4 | const std = @import("../../../std.zig"); | |
| 5 | 5 | const linux = std.os.linux; |
| 6 | 6 | const socklen_t = linux.socklen_t; |
| 7 | 7 | const iovec = linux.iovec; |
| 8 | 8 | const iovec_const = linux.iovec_const; |
| 9 | const uid_t = linux.uid_t; | |
| 10 | const gid_t = linux.gid_t; | |
| 9 | 11 | |
| 10 | 12 | pub const SYS_io_setup = 0; |
| 11 | 13 | pub const SYS_io_destroy = 1; |
| ... | ... | @@ -382,6 +384,15 @@ pub const msghdr_const = extern struct { |
| 382 | 384 | msg_flags: i32, |
| 383 | 385 | }; |
| 384 | 386 | |
| 387 | pub const blksize_t = i32; | |
| 388 | pub const nlink_t = u32; | |
| 389 | pub const time_t = isize; | |
| 390 | pub const mode_t = u32; | |
| 391 | pub const off_t = isize; | |
| 392 | pub const ino_t = usize; | |
| 393 | pub const dev_t = usize; | |
| 394 | pub const blkcnt_t = isize; | |
| 395 | ||
| 385 | 396 | /// Renamed to Stat to not conflict with the stat function. |
| 386 | 397 | /// atime, mtime, and ctime have functions to return `timespec`, |
| 387 | 398 | /// because although this is a POSIX API, the layout and names of |
| ... | ... | @@ -389,23 +400,22 @@ pub const msghdr_const = extern struct { |
| 389 | 400 | /// in C, macros are used to hide the differences. Here we use |
| 390 | 401 | /// methods to accomplish this. |
| 391 | 402 | pub const Stat = extern struct { |
| 392 | dev: u64, | |
| 393 | ino: u64, | |
| 394 | nlink: usize, | |
| 395 | ||
| 396 | mode: u32, | |
| 397 | uid: u32, | |
| 398 | gid: u32, | |
| 399 | __pad0: u32, | |
| 400 | rdev: u64, | |
| 401 | size: i64, | |
| 402 | blksize: isize, | |
| 403 | blocks: i64, | |
| 404 | ||
| 403 | dev: dev_t, | |
| 404 | ino: ino_t, | |
| 405 | mode: mode_t, | |
| 406 | nlink: nlink_t, | |
| 407 | uid: uid_t, | |
| 408 | gid: gid_t, | |
| 409 | rdev: dev_t, | |
| 410 | __pad: usize, | |
| 411 | size: off_t, | |
| 412 | blksize: blksize_t, | |
| 413 | __pad2: i32, | |
| 414 | blocks: blkcnt_t, | |
| 405 | 415 | atim: timespec, |
| 406 | 416 | mtim: timespec, |
| 407 | 417 | ctim: timespec, |
| 408 | __unused: [3]isize, | |
| 418 | __unused: [2]u32, | |
| 409 | 419 | |
| 410 | 420 | pub fn atime(self: Stat) timespec { |
| 411 | 421 | return self.atim; |
| ... | ... | @@ -421,7 +431,7 @@ pub const Stat = extern struct { |
| 421 | 431 | }; |
| 422 | 432 | |
| 423 | 433 | pub const timespec = extern struct { |
| 424 | tv_sec: isize, | |
| 434 | tv_sec: time_t, | |
| 425 | 435 | tv_nsec: isize, |
| 426 | 436 | }; |
| 427 | 437 |
std/os/bits/linux/x86_64.zig+3-1| ... | ... | @@ -479,6 +479,8 @@ pub const msghdr_const = extern struct { |
| 479 | 479 | msg_flags: i32, |
| 480 | 480 | }; |
| 481 | 481 | |
| 482 | pub const off_t = i64; | |
| 483 | ||
| 482 | 484 | /// Renamed to Stat to not conflict with the stat function. |
| 483 | 485 | /// atime, mtime, and ctime have functions to return `timespec`, |
| 484 | 486 | /// because although this is a POSIX API, the layout and names of |
| ... | ... | @@ -495,7 +497,7 @@ pub const Stat = extern struct { |
| 495 | 497 | gid: u32, |
| 496 | 498 | __pad0: u32, |
| 497 | 499 | rdev: u64, |
| 498 | size: i64, | |
| 500 | size: off_t, | |
| 499 | 501 | blksize: isize, |
| 500 | 502 | blocks: i64, |
| 501 | 503 |
std/os/bits/netbsd.zig+3-1| ... | ... | @@ -73,6 +73,8 @@ pub const msghdr_const = extern struct { |
| 73 | 73 | msg_flags: i32, |
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | pub const off_t = i64; | |
| 77 | ||
| 76 | 78 | /// Renamed to Stat to not conflict with the stat function. |
| 77 | 79 | /// atime, mtime, and ctime have functions to return `timespec`, |
| 78 | 80 | /// because although this is a POSIX API, the layout and names of |
| ... | ... | @@ -94,7 +96,7 @@ pub const Stat = extern struct { |
| 94 | 96 | ctim: timespec, |
| 95 | 97 | birthtim: timespec, |
| 96 | 98 | |
| 97 | size: i64, | |
| 99 | size: off_t, | |
| 98 | 100 | blocks: i64, |
| 99 | 101 | blksize: isize, |
| 100 | 102 | flags: u32, |
std/os/test.zig+4| ... | ... | @@ -95,6 +95,10 @@ test "cpu count" { |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | test "AtomicFile" { |
| 98 | if (builtin.arch == .aarch64 and builtin.glibc_version != null) { | |
| 99 | // TODO https://github.com/ziglang/zig/issues/3288 | |
| 100 | return error.SkipZigTest; | |
| 101 | } | |
| 98 | 102 | var buffer: [1024]u8 = undefined; |
| 99 | 103 | const allocator = &std.heap.FixedBufferAllocator.init(buffer[0..]).allocator; |
| 100 | 104 | const test_out_file = "tmp_atomic_file_test_dest.txt"; |
std/rb.zig+9| ... | ... | @@ -511,6 +511,11 @@ fn testCompare(l: *Node, r: *Node) mem.Compare { |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | test "rb" { |
| 514 | if (@import("builtin").arch == .aarch64) { | |
| 515 | // TODO https://github.com/ziglang/zig/issues/3288 | |
| 516 | return error.SkipZigTest; | |
| 517 | } | |
| 518 | ||
| 514 | 519 | var tree: Tree = undefined; |
| 515 | 520 | var ns: [10]testNumber = undefined; |
| 516 | 521 | ns[0].value = 42; |
| ... | ... | @@ -571,6 +576,10 @@ test "inserting and looking up" { |
| 571 | 576 | } |
| 572 | 577 | |
| 573 | 578 | test "multiple inserts, followed by calling first and last" { |
| 579 | if (@import("builtin").arch == .aarch64) { | |
| 580 | // TODO https://github.com/ziglang/zig/issues/3288 | |
| 581 | return error.SkipZigTest; | |
| 582 | } | |
| 574 | 583 | var tree: Tree = undefined; |
| 575 | 584 | tree.init(testCompare); |
| 576 | 585 | var zeroth: testNumber = undefined; |
std/special/compiler_rt.zig+7-4| ... | ... | @@ -143,7 +143,7 @@ comptime { |
| 143 | 143 | @export("__negsf2", @import("compiler_rt/negXf2.zig").__negsf2, linkage); |
| 144 | 144 | @export("__negdf2", @import("compiler_rt/negXf2.zig").__negdf2, linkage); |
| 145 | 145 | |
| 146 | if (is_arm_arch and !is_arm_64) { | |
| 146 | if (is_arm_arch and !is_arm_64 and !is_test) { | |
| 147 | 147 | @export("__aeabi_unwind_cpp_pr0", __aeabi_unwind_cpp_pr0, strong_linkage); |
| 148 | 148 | @export("__aeabi_unwind_cpp_pr1", __aeabi_unwind_cpp_pr1, linkage); |
| 149 | 149 | @export("__aeabi_unwind_cpp_pr2", __aeabi_unwind_cpp_pr2, linkage); |
| ... | ... | @@ -233,7 +233,7 @@ comptime { |
| 233 | 233 | @export("__aeabi_dcmpgt", @import("compiler_rt/arm/aeabi_dcmp.zig").__aeabi_dcmpgt, linkage); |
| 234 | 234 | @export("__aeabi_dcmpun", @import("compiler_rt/comparedf2.zig").__unorddf2, linkage); |
| 235 | 235 | } |
| 236 | if (builtin.os == builtin.Os.windows) { | |
| 236 | if (builtin.os == .windows) { | |
| 237 | 237 | if (!builtin.link_libc) { |
| 238 | 238 | @export("_chkstk", @import("compiler_rt/stack_probe.zig")._chkstk, strong_linkage); |
| 239 | 239 | @export("__chkstk", @import("compiler_rt/stack_probe.zig").__chkstk, strong_linkage); |
| ... | ... | @@ -247,11 +247,11 @@ comptime { |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | switch (builtin.arch) { |
| 250 | builtin.Arch.i386 => { | |
| 250 | .i386 => { | |
| 251 | 251 | @export("_aulldiv", @import("compiler_rt/aulldiv.zig")._aulldiv, strong_linkage); |
| 252 | 252 | @export("_aullrem", @import("compiler_rt/aullrem.zig")._aullrem, strong_linkage); |
| 253 | 253 | }, |
| 254 | builtin.Arch.x86_64 => { | |
| 254 | .x86_64 => { | |
| 255 | 255 | // The "ti" functions must use @Vector(2, u64) parameter types to adhere to the ABI |
| 256 | 256 | // that LLVM expects compiler-rt to have. |
| 257 | 257 | @export("__divti3", @import("compiler_rt/divti3.zig").__divti3_windows_x86_64, linkage); |
| ... | ... | @@ -264,6 +264,9 @@ comptime { |
| 264 | 264 | else => {}, |
| 265 | 265 | } |
| 266 | 266 | } else { |
| 267 | if (builtin.glibc_version != null) { | |
| 268 | @export("__stack_chk_guard", __stack_chk_guard, linkage); | |
| 269 | } | |
| 267 | 270 | @export("__divti3", @import("compiler_rt/divti3.zig").__divti3, linkage); |
| 268 | 271 | @export("__modti3", @import("compiler_rt/modti3.zig").__modti3, linkage); |
| 269 | 272 | @export("__multi3", @import("compiler_rt/multi3.zig").__multi3, linkage); |
std/special/compiler_rt/arm/aeabi_dcmp.zig+6-6| ... | ... | @@ -14,31 +14,31 @@ const ConditionalOperator = enum { |
| 14 | 14 | |
| 15 | 15 | pub nakedcc fn __aeabi_dcmpeq() noreturn { |
| 16 | 16 | @setRuntimeSafety(false); |
| 17 | aeabi_dcmp(.Eq); | |
| 17 | @inlineCall(aeabi_dcmp, .Eq); | |
| 18 | 18 | unreachable; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | pub nakedcc fn __aeabi_dcmplt() noreturn { |
| 22 | 22 | @setRuntimeSafety(false); |
| 23 | aeabi_dcmp(.Lt); | |
| 23 | @inlineCall(aeabi_dcmp, .Lt); | |
| 24 | 24 | unreachable; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | pub nakedcc fn __aeabi_dcmple() noreturn { |
| 28 | 28 | @setRuntimeSafety(false); |
| 29 | aeabi_dcmp(.Le); | |
| 29 | @inlineCall(aeabi_dcmp, .Le); | |
| 30 | 30 | unreachable; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | pub nakedcc fn __aeabi_dcmpge() noreturn { |
| 34 | 34 | @setRuntimeSafety(false); |
| 35 | aeabi_dcmp(.Ge); | |
| 35 | @inlineCall(aeabi_dcmp, .Ge); | |
| 36 | 36 | unreachable; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | pub nakedcc fn __aeabi_dcmpgt() noreturn { |
| 40 | 40 | @setRuntimeSafety(false); |
| 41 | aeabi_dcmp(.Gt); | |
| 41 | @inlineCall(aeabi_dcmp, .Gt); | |
| 42 | 42 | unreachable; |
| 43 | 43 | } |
| 44 | 44 | |
| ... | ... | @@ -49,7 +49,7 @@ inline fn convert_dcmp_args_to_df2_args() void { |
| 49 | 49 | ); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | inline fn aeabi_dcmp(comptime cond: ConditionalOperator) void { | |
| 52 | fn aeabi_dcmp(comptime cond: ConditionalOperator) void { | |
| 53 | 53 | @setRuntimeSafety(false); |
| 54 | 54 | asm volatile ( |
| 55 | 55 | \\ push { r4, lr } |
std/special/compiler_rt/arm/aeabi_fcmp.zig+6-6| ... | ... | @@ -14,31 +14,31 @@ const ConditionalOperator = enum { |
| 14 | 14 | |
| 15 | 15 | pub nakedcc fn __aeabi_fcmpeq() noreturn { |
| 16 | 16 | @setRuntimeSafety(false); |
| 17 | aeabi_fcmp(.Eq); | |
| 17 | @inlineCall(aeabi_fcmp, .Eq); | |
| 18 | 18 | unreachable; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | pub nakedcc fn __aeabi_fcmplt() noreturn { |
| 22 | 22 | @setRuntimeSafety(false); |
| 23 | aeabi_fcmp(.Lt); | |
| 23 | @inlineCall(aeabi_fcmp, .Lt); | |
| 24 | 24 | unreachable; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | pub nakedcc fn __aeabi_fcmple() noreturn { |
| 28 | 28 | @setRuntimeSafety(false); |
| 29 | aeabi_fcmp(.Le); | |
| 29 | @inlineCall(aeabi_fcmp, .Le); | |
| 30 | 30 | unreachable; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | pub nakedcc fn __aeabi_fcmpge() noreturn { |
| 34 | 34 | @setRuntimeSafety(false); |
| 35 | aeabi_fcmp(.Ge); | |
| 35 | @inlineCall(aeabi_fcmp, .Ge); | |
| 36 | 36 | unreachable; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | pub nakedcc fn __aeabi_fcmpgt() noreturn { |
| 40 | 40 | @setRuntimeSafety(false); |
| 41 | aeabi_fcmp(.Gt); | |
| 41 | @inlineCall(aeabi_fcmp, .Gt); | |
| 42 | 42 | unreachable; |
| 43 | 43 | } |
| 44 | 44 | |
| ... | ... | @@ -49,7 +49,7 @@ inline fn convert_fcmp_args_to_sf2_args() void { |
| 49 | 49 | ); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | inline fn aeabi_fcmp(comptime cond: ConditionalOperator) void { | |
| 52 | fn aeabi_fcmp(comptime cond: ConditionalOperator) void { | |
| 53 | 53 | @setRuntimeSafety(false); |
| 54 | 54 | asm volatile ( |
| 55 | 55 | \\ push { r4, lr } |
test/tests.zig+239-57| ... | ... | @@ -23,21 +23,183 @@ const runtime_safety = @import("runtime_safety.zig"); |
| 23 | 23 | const translate_c = @import("translate_c.zig"); |
| 24 | 24 | const gen_h = @import("gen_h.zig"); |
| 25 | 25 | |
| 26 | const cross_targets = [_]CrossTarget{ | |
| 27 | CrossTarget{ | |
| 28 | .os = .linux, | |
| 29 | .arch = .x86_64, | |
| 30 | .abi = .gnu, | |
| 26 | const TestTarget = struct { | |
| 27 | target: Target = .Native, | |
| 28 | mode: builtin.Mode = .Debug, | |
| 29 | link_libc: bool = false, | |
| 30 | single_threaded: bool = false, | |
| 31 | disable_native: bool = false, | |
| 32 | }; | |
| 33 | ||
| 34 | const test_targets = [_]TestTarget{ | |
| 35 | TestTarget{}, | |
| 36 | TestTarget{ | |
| 37 | .link_libc = true, | |
| 38 | }, | |
| 39 | TestTarget{ | |
| 40 | .single_threaded = true, | |
| 41 | }, | |
| 42 | ||
| 43 | TestTarget{ | |
| 44 | .target = Target{ | |
| 45 | .Cross = CrossTarget{ | |
| 46 | .os = .linux, | |
| 47 | .arch = .x86_64, | |
| 48 | .abi = .none, | |
| 49 | }, | |
| 50 | }, | |
| 51 | }, | |
| 52 | TestTarget{ | |
| 53 | .target = Target{ | |
| 54 | .Cross = CrossTarget{ | |
| 55 | .os = .linux, | |
| 56 | .arch = .x86_64, | |
| 57 | .abi = .gnu, | |
| 58 | }, | |
| 59 | }, | |
| 60 | .link_libc = true, | |
| 61 | }, | |
| 62 | TestTarget{ | |
| 63 | .target = Target{ | |
| 64 | .Cross = CrossTarget{ | |
| 65 | .os = .linux, | |
| 66 | .arch = .x86_64, | |
| 67 | .abi = .musl, | |
| 68 | }, | |
| 69 | }, | |
| 70 | .link_libc = true, | |
| 71 | }, | |
| 72 | ||
| 73 | TestTarget{ | |
| 74 | .target = Target{ | |
| 75 | .Cross = CrossTarget{ | |
| 76 | .os = .linux, | |
| 77 | .arch = builtin.Arch{ .aarch64 = builtin.Arch.Arm64.v8_5a }, | |
| 78 | .abi = .none, | |
| 79 | }, | |
| 80 | }, | |
| 81 | }, | |
| 82 | TestTarget{ | |
| 83 | .target = Target{ | |
| 84 | .Cross = CrossTarget{ | |
| 85 | .os = .linux, | |
| 86 | .arch = builtin.Arch{ .aarch64 = builtin.Arch.Arm64.v8_5a }, | |
| 87 | .abi = .musl, | |
| 88 | }, | |
| 89 | }, | |
| 90 | .link_libc = true, | |
| 91 | }, | |
| 92 | TestTarget{ | |
| 93 | .target = Target{ | |
| 94 | .Cross = CrossTarget{ | |
| 95 | .os = .linux, | |
| 96 | .arch = builtin.Arch{ .aarch64 = builtin.Arch.Arm64.v8_5a }, | |
| 97 | .abi = .gnu, | |
| 98 | }, | |
| 99 | }, | |
| 100 | .link_libc = true, | |
| 101 | }, | |
| 102 | ||
| 103 | TestTarget{ | |
| 104 | .target = Target{ | |
| 105 | .Cross = CrossTarget{ | |
| 106 | .os = .linux, | |
| 107 | .arch = builtin.Arch{ .arm = builtin.Arch.Arm32.v8_5a }, | |
| 108 | .abi = .none, | |
| 109 | }, | |
| 110 | }, | |
| 111 | }, | |
| 112 | // TODO https://github.com/ziglang/zig/issues/3286 | |
| 113 | //TestTarget{ | |
| 114 | // .target = Target{ | |
| 115 | // .Cross = CrossTarget{ | |
| 116 | // .os = .linux, | |
| 117 | // .arch = builtin.Arch{ .arm = builtin.Arch.Arm32.v8_5a }, | |
| 118 | // .abi = .musleabihf, | |
| 119 | // }, | |
| 120 | // }, | |
| 121 | // .link_libc = true, | |
| 122 | //}, | |
| 123 | // TODO https://github.com/ziglang/zig/issues/3287 | |
| 124 | //TestTarget{ | |
| 125 | // .target = Target{ | |
| 126 | // .Cross = CrossTarget{ | |
| 127 | // .os = .linux, | |
| 128 | // .arch = builtin.Arch{ .arm = builtin.Arch.Arm32.v8_5a }, | |
| 129 | // .abi = .gnueabihf, | |
| 130 | // }, | |
| 131 | // }, | |
| 132 | // .link_libc = true, | |
| 133 | //}, | |
| 134 | ||
| 135 | TestTarget{ | |
| 136 | .target = Target{ | |
| 137 | .Cross = CrossTarget{ | |
| 138 | .os = .macosx, | |
| 139 | .arch = .x86_64, | |
| 140 | .abi = .gnu, | |
| 141 | }, | |
| 142 | }, | |
| 143 | // TODO https://github.com/ziglang/zig/issues/3295 | |
| 144 | .disable_native = true, | |
| 145 | }, | |
| 146 | ||
| 147 | TestTarget{ | |
| 148 | .target = Target{ | |
| 149 | .Cross = CrossTarget{ | |
| 150 | .os = .windows, | |
| 151 | .arch = .x86_64, | |
| 152 | .abi = .msvc, | |
| 153 | }, | |
| 154 | }, | |
| 155 | }, | |
| 156 | ||
| 157 | TestTarget{ | |
| 158 | .target = Target{ | |
| 159 | .Cross = CrossTarget{ | |
| 160 | .os = .windows, | |
| 161 | .arch = .x86_64, | |
| 162 | .abi = .gnu, | |
| 163 | }, | |
| 164 | }, | |
| 165 | .link_libc = true, | |
| 31 | 166 | }, |
| 32 | CrossTarget{ | |
| 33 | .os = .macosx, | |
| 34 | .arch = .x86_64, | |
| 35 | .abi = .gnu, | |
| 167 | ||
| 168 | // Do the release tests last because they take a long time | |
| 169 | TestTarget{ | |
| 170 | .mode = .ReleaseFast, | |
| 171 | }, | |
| 172 | TestTarget{ | |
| 173 | .link_libc = true, | |
| 174 | .mode = .ReleaseFast, | |
| 175 | }, | |
| 176 | TestTarget{ | |
| 177 | .mode = .ReleaseFast, | |
| 178 | .single_threaded = true, | |
| 179 | }, | |
| 180 | ||
| 181 | TestTarget{ | |
| 182 | .mode = .ReleaseSafe, | |
| 183 | }, | |
| 184 | TestTarget{ | |
| 185 | .link_libc = true, | |
| 186 | .mode = .ReleaseSafe, | |
| 187 | }, | |
| 188 | TestTarget{ | |
| 189 | .mode = .ReleaseSafe, | |
| 190 | .single_threaded = true, | |
| 36 | 191 | }, |
| 37 | CrossTarget{ | |
| 38 | .os = .windows, | |
| 39 | .arch = .x86_64, | |
| 40 | .abi = .msvc, | |
| 192 | ||
| 193 | TestTarget{ | |
| 194 | .mode = .ReleaseSmall, | |
| 195 | }, | |
| 196 | TestTarget{ | |
| 197 | .link_libc = true, | |
| 198 | .mode = .ReleaseSmall, | |
| 199 | }, | |
| 200 | TestTarget{ | |
| 201 | .mode = .ReleaseSmall, | |
| 202 | .single_threaded = true, | |
| 41 | 203 | }, |
| 42 | 204 | }; |
| 43 | 205 | |
| ... | ... | @@ -182,57 +344,77 @@ pub fn addPkgTests( |
| 182 | 344 | name: []const u8, |
| 183 | 345 | desc: []const u8, |
| 184 | 346 | modes: []const Mode, |
| 185 | single_threaded_list: []const bool, | |
| 347 | skip_single_threaded: bool, | |
| 186 | 348 | skip_non_native: bool, |
| 349 | skip_libc: bool, | |
| 350 | is_wine_enabled: bool, | |
| 351 | is_qemu_enabled: bool, | |
| 352 | glibc_dir: ?[]const u8, | |
| 187 | 353 | ) *build.Step { |
| 188 | 354 | const step = b.step(b.fmt("test-{}", name), desc); |
| 189 | 355 | |
| 190 | var targets = std.ArrayList(*const CrossTarget).init(b.allocator); | |
| 191 | defer targets.deinit(); | |
| 192 | const host = CrossTarget{ .os = builtin.os, .arch = builtin.arch, .abi = builtin.abi }; | |
| 193 | targets.append(&host) catch unreachable; | |
| 194 | for (cross_targets) |*t| { | |
| 195 | if (t.os == builtin.os and t.arch == builtin.arch and t.abi == builtin.abi) continue; | |
| 196 | targets.append(t) catch unreachable; | |
| 197 | } | |
| 356 | for (test_targets) |test_target| { | |
| 357 | if (skip_non_native and test_target.target != .Native) | |
| 358 | continue; | |
| 198 | 359 | |
| 199 | for (targets.toSliceConst()) |test_target| { | |
| 200 | const is_native = (test_target.os == builtin.os and test_target.arch == builtin.arch); | |
| 201 | if (skip_non_native and !is_native) | |
| 360 | if (skip_libc and test_target.link_libc) | |
| 361 | continue; | |
| 362 | ||
| 363 | if (test_target.link_libc and test_target.target.osRequiresLibC()) { | |
| 364 | // This would be a redundant test. | |
| 365 | continue; | |
| 366 | } | |
| 367 | ||
| 368 | if (skip_single_threaded and test_target.single_threaded) | |
| 369 | continue; | |
| 370 | ||
| 371 | const ArchTag = @TagType(builtin.Arch); | |
| 372 | if (test_target.disable_native and | |
| 373 | test_target.target.getOs() == builtin.os and | |
| 374 | ArchTag(test_target.target.getArch()) == ArchTag(builtin.arch)) | |
| 375 | { | |
| 202 | 376 | continue; |
| 203 | for (modes) |mode| { | |
| 204 | for ([_]bool{ false, true }) |link_libc| { | |
| 205 | for (single_threaded_list) |single_threaded| { | |
| 206 | if (link_libc and !is_native) { | |
| 207 | // don't assume we have a cross-compiling libc set up | |
| 208 | continue; | |
| 209 | } | |
| 210 | const these_tests = b.addTest(root_src); | |
| 211 | these_tests.setNamePrefix(b.fmt( | |
| 212 | "{}-{}-{}-{}-{}-{} ", | |
| 213 | name, | |
| 214 | @tagName(test_target.os), | |
| 215 | @tagName(test_target.arch), | |
| 216 | @tagName(mode), | |
| 217 | if (link_libc) "c" else "bare", | |
| 218 | if (single_threaded) "single" else "multi", | |
| 219 | )); | |
| 220 | these_tests.single_threaded = single_threaded; | |
| 221 | these_tests.setFilter(test_filter); | |
| 222 | these_tests.setBuildMode(mode); | |
| 223 | if (!is_native) { | |
| 224 | these_tests.setTarget(test_target.arch, test_target.os, test_target.abi); | |
| 225 | } | |
| 226 | if (link_libc) { | |
| 227 | these_tests.linkSystemLibrary("c"); | |
| 228 | } | |
| 229 | if (mem.eql(u8, name, "std")) { | |
| 230 | these_tests.overrideStdDir("std"); | |
| 231 | } | |
| 232 | step.dependOn(&these_tests.step); | |
| 233 | } | |
| 234 | } | |
| 235 | 377 | } |
| 378 | ||
| 379 | const want_this_mode = for (modes) |m| { | |
| 380 | if (m == test_target.mode) break true; | |
| 381 | } else false; | |
| 382 | if (!want_this_mode) continue; | |
| 383 | ||
| 384 | const libc_prefix = if (test_target.target.osRequiresLibC()) | |
| 385 | "" | |
| 386 | else if (test_target.link_libc) | |
| 387 | "c" | |
| 388 | else | |
| 389 | "bare"; | |
| 390 | ||
| 391 | const triple_prefix = if (test_target.target == .Native) | |
| 392 | ([]const u8)("native") | |
| 393 | else | |
| 394 | test_target.target.zigTripleNoSubArch(b.allocator) catch unreachable; | |
| 395 | ||
| 396 | const these_tests = b.addTest(root_src); | |
| 397 | these_tests.setNamePrefix(b.fmt( | |
| 398 | "{}-{}-{}-{}-{} ", | |
| 399 | name, | |
| 400 | triple_prefix, | |
| 401 | @tagName(test_target.mode), | |
| 402 | libc_prefix, | |
| 403 | if (test_target.single_threaded) "single" else "multi", | |
| 404 | )); | |
| 405 | these_tests.single_threaded = test_target.single_threaded; | |
| 406 | these_tests.setFilter(test_filter); | |
| 407 | these_tests.setBuildMode(test_target.mode); | |
| 408 | these_tests.setTheTarget(test_target.target); | |
| 409 | if (test_target.link_libc) { | |
| 410 | these_tests.linkSystemLibrary("c"); | |
| 411 | } | |
| 412 | these_tests.overrideStdDir("std"); | |
| 413 | these_tests.enable_wine = is_wine_enabled; | |
| 414 | these_tests.enable_qemu = is_qemu_enabled; | |
| 415 | these_tests.glibc_multi_install_dir = glibc_dir; | |
| 416 | ||
| 417 | step.dependOn(&these_tests.step); | |
| 236 | 418 | } |
| 237 | 419 | return step; |
| 238 | 420 | } |