| author | |
| committer | |
| log | b24cbecdb2abb4399d65553ebade318263cd57d3 |
| tree | bb56e8effbdef5ec7f4ebb48e635ca9d71f14c42 |
| parent | cbd653e1d678f0560f5ed3e93a41caa512d93443 |
from zig-specific options to generally recognized zig build options that
any project can take advantage of. See the updated usage text for more
details.7 files changed, 86 insertions(+), 235 deletions(-)
build.zig+6-37| ... | ... | @@ -296,13 +296,6 @@ pub fn build(b: *Builder) !void { |
| 296 | 296 | |
| 297 | 297 | const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter"); |
| 298 | 298 | |
| 299 | const is_wine_enabled = b.option(bool, "enable-wine", "Use Wine to run cross compiled Windows tests") orelse false; | |
| 300 | const is_qemu_enabled = b.option(bool, "enable-qemu", "Use QEMU to run cross compiled foreign architecture tests") orelse false; | |
| 301 | const is_wasmtime_enabled = b.option(bool, "enable-wasmtime", "Use Wasmtime to enable and run WASI libstd tests") orelse false; | |
| 302 | const is_darling_enabled = b.option(bool, "enable-darling", "[Experimental] Use Darling to run cross compiled macOS tests") orelse false; | |
| 303 | const is_rosetta_enabled = b.option(bool, "enable-rosetta", "(Darwin) Use Rosetta to run x86_64 macOS tests on arm64 macOS") orelse false; | |
| 304 | const glibc_multi_dir = b.option([]const u8, "enable-foreign-glibc", "Provide directory with glibc installations to run cross compiled tests that link glibc"); | |
| 305 | ||
| 306 | 299 | const test_stage2_options = b.addOptions(); |
| 307 | 300 | test_stage2.addOptions("build_options", test_stage2_options); |
| 308 | 301 | |
| ... | ... | @@ -317,13 +310,13 @@ pub fn build(b: *Builder) !void { |
| 317 | 310 | test_stage2_options.addOption(bool, "llvm_has_csky", llvm_has_csky); |
| 318 | 311 | test_stage2_options.addOption(bool, "llvm_has_ve", llvm_has_ve); |
| 319 | 312 | test_stage2_options.addOption(bool, "llvm_has_arc", llvm_has_arc); |
| 320 | test_stage2_options.addOption(bool, "enable_qemu", is_qemu_enabled); | |
| 321 | test_stage2_options.addOption(bool, "enable_wine", is_wine_enabled); | |
| 322 | test_stage2_options.addOption(bool, "enable_wasmtime", is_wasmtime_enabled); | |
| 323 | test_stage2_options.addOption(bool, "enable_rosetta", is_rosetta_enabled); | |
| 313 | test_stage2_options.addOption(bool, "enable_qemu", b.enable_qemu); | |
| 314 | test_stage2_options.addOption(bool, "enable_wine", b.enable_wine); | |
| 315 | test_stage2_options.addOption(bool, "enable_wasmtime", b.enable_wasmtime); | |
| 316 | test_stage2_options.addOption(bool, "enable_rosetta", b.enable_rosetta); | |
| 317 | test_stage2_options.addOption(bool, "enable_darling", b.enable_darling); | |
| 324 | 318 | test_stage2_options.addOption(u32, "mem_leak_frames", mem_leak_frames * 2); |
| 325 | test_stage2_options.addOption(bool, "enable_darling", is_darling_enabled); | |
| 326 | test_stage2_options.addOption(?[]const u8, "glibc_multi_install_dir", glibc_multi_dir); | |
| 319 | test_stage2_options.addOption(?[]const u8, "glibc_runtimes_dir", b.glibc_runtimes_dir); | |
| 327 | 320 | test_stage2_options.addOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); |
| 328 | 321 | test_stage2_options.addOption(std.SemanticVersion, "semver", semver); |
| 329 | 322 | |
| ... | ... | @@ -368,12 +361,6 @@ pub fn build(b: *Builder) !void { |
| 368 | 361 | false, // skip_single_threaded |
| 369 | 362 | skip_non_native, |
| 370 | 363 | skip_libc, |
| 371 | is_wine_enabled, | |
| 372 | is_qemu_enabled, | |
| 373 | is_wasmtime_enabled, | |
| 374 | is_darling_enabled, | |
| 375 | is_rosetta_enabled, | |
| 376 | glibc_multi_dir, | |
| 377 | 364 | )); |
| 378 | 365 | |
| 379 | 366 | toolchain_step.dependOn(tests.addPkgTests( |
| ... | ... | @@ -386,12 +373,6 @@ pub fn build(b: *Builder) !void { |
| 386 | 373 | true, // skip_single_threaded |
| 387 | 374 | skip_non_native, |
| 388 | 375 | true, // skip_libc |
| 389 | is_wine_enabled, | |
| 390 | is_qemu_enabled, | |
| 391 | is_wasmtime_enabled, | |
| 392 | is_darling_enabled, | |
| 393 | is_rosetta_enabled, | |
| 394 | glibc_multi_dir, | |
| 395 | 376 | )); |
| 396 | 377 | |
| 397 | 378 | toolchain_step.dependOn(tests.addPkgTests( |
| ... | ... | @@ -404,12 +385,6 @@ pub fn build(b: *Builder) !void { |
| 404 | 385 | true, // skip_single_threaded |
| 405 | 386 | skip_non_native, |
| 406 | 387 | true, // skip_libc |
| 407 | is_wine_enabled, | |
| 408 | is_qemu_enabled, | |
| 409 | is_wasmtime_enabled, | |
| 410 | is_darling_enabled, | |
| 411 | is_rosetta_enabled, | |
| 412 | glibc_multi_dir, | |
| 413 | 388 | )); |
| 414 | 389 | |
| 415 | 390 | toolchain_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes)); |
| ... | ... | @@ -435,12 +410,6 @@ pub fn build(b: *Builder) !void { |
| 435 | 410 | false, |
| 436 | 411 | skip_non_native, |
| 437 | 412 | skip_libc, |
| 438 | is_wine_enabled, | |
| 439 | is_qemu_enabled, | |
| 440 | is_wasmtime_enabled, | |
| 441 | is_darling_enabled, | |
| 442 | is_rosetta_enabled, | |
| 443 | glibc_multi_dir, | |
| 444 | 413 | ); |
| 445 | 414 | |
| 446 | 415 | const test_step = b.step("test", "Run all the tests"); |
ci/azure/linux_script deleted-142| ... | ... | @@ -1,142 +0,0 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | set -x | |
| 4 | set -e | |
| 5 | ||
| 6 | sudo apt-get update -q | |
| 7 | sudo apt-get install -y cmake s3cmd tidy | |
| 8 | ||
| 9 | ZIGDIR="$(pwd)" | |
| 10 | ARCH="$(uname -m)" | |
| 11 | TARGET="$ARCH-linux-musl" | |
| 12 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.9.0-dev.1243+456d7e5f5" | |
| 13 | PREFIX="$HOME/$CACHE_BASENAME" | |
| 14 | MCPU="baseline" | |
| 15 | JOBS="-j$(nproc)" | |
| 16 | ||
| 17 | rm -rf $PREFIX | |
| 18 | cd $HOME | |
| 19 | ||
| 20 | wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz" | |
| 21 | tar xf "$CACHE_BASENAME.tar.xz" | |
| 22 | ||
| 23 | QEMUBASE="qemu-linux-x86_64-6.1.0.1" | |
| 24 | wget -nv "https://ziglang.org/deps/$QEMUBASE.tar.xz" | |
| 25 | tar xf "$QEMUBASE.tar.xz" | |
| 26 | export PATH="$(pwd)/$QEMUBASE/bin:$PATH" | |
| 27 | ||
| 28 | WASMTIME="wasmtime-v0.26.1-x86_64-linux" | |
| 29 | wget -nv "https://github.com/bytecodealliance/wasmtime/releases/download/v0.26.1/$WASMTIME.tar.xz" | |
| 30 | tar xf "$WASMTIME.tar.xz" | |
| 31 | export PATH="$(pwd)/$WASMTIME:$PATH" | |
| 32 | ||
| 33 | ZIG="$PREFIX/bin/zig" | |
| 34 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | |
| 35 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | |
| 36 | ||
| 37 | cd $ZIGDIR | |
| 38 | ||
| 39 | # Make the `zig version` number consistent. | |
| 40 | # This will affect the cmake command below. | |
| 41 | git config core.abbrev 9 | |
| 42 | git fetch --unshallow || true | |
| 43 | git fetch --tags | |
| 44 | ||
| 45 | mkdir build | |
| 46 | cd build | |
| 47 | cmake .. \ | |
| 48 | -DCMAKE_INSTALL_PREFIX="$(pwd)/release" \ | |
| 49 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 50 | -DCMAKE_BUILD_TYPE=Release \ | |
| 51 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 52 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 53 | -DZIG_STATIC=ON | |
| 54 | ||
| 55 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | |
| 56 | # so that installation and testing do not get affected by them. | |
| 57 | unset CC | |
| 58 | unset CXX | |
| 59 | ||
| 60 | make $JOBS install | |
| 61 | ||
| 62 | # Look for non-conforming code formatting. | |
| 63 | # Formatting errors can be fixed by running `zig fmt` on the files printed here. | |
| 64 | release/bin/zig fmt --check .. | |
| 65 | ||
| 66 | # Here we rebuild zig but this time using the Zig binary we just now produced to | |
| 67 | # build zig1.o rather than relying on the one built with stage0. See | |
| 68 | # https://github.com/ziglang/zig/issues/6830 for more details. | |
| 69 | cmake .. -DZIG_EXECUTABLE="$(pwd)/release/bin/zig" | |
| 70 | make $JOBS install | |
| 71 | ||
| 72 | release/bin/zig test ../test/behavior.zig -fno-stage1 -fLLVM -I ../test | |
| 73 | ||
| 74 | release/bin/zig build test-behavior -Denable-qemu -Denable-wasmtime | |
| 75 | release/bin/zig build test-compiler-rt -Denable-qemu -Denable-wasmtime | |
| 76 | release/bin/zig build test-std -Denable-qemu -Denable-wasmtime | |
| 77 | release/bin/zig build test-minilibc -Denable-qemu -Denable-wasmtime | |
| 78 | release/bin/zig build test-compare-output -Denable-qemu -Denable-wasmtime | |
| 79 | release/bin/zig build test-standalone -Denable-qemu -Denable-wasmtime | |
| 80 | release/bin/zig build test-stack-traces -Denable-qemu -Denable-wasmtime | |
| 81 | release/bin/zig build test-cli -Denable-qemu -Denable-wasmtime | |
| 82 | release/bin/zig build test-asm-link -Denable-qemu -Denable-wasmtime | |
| 83 | release/bin/zig build test-runtime-safety -Denable-qemu -Denable-wasmtime | |
| 84 | release/bin/zig build test-translate-c -Denable-qemu -Denable-wasmtime | |
| 85 | release/bin/zig build test-run-translated-c -Denable-qemu -Denable-wasmtime | |
| 86 | release/bin/zig build docs -Denable-qemu -Denable-wasmtime | |
| 87 | release/bin/zig build # test building self-hosted without LLVM | |
| 88 | release/bin/zig build test-fmt -Denable-qemu -Denable-wasmtime | |
| 89 | release/bin/zig build test-stage2 -Denable-qemu -Denable-wasmtime | |
| 90 | ||
| 91 | # Look for HTML errors. | |
| 92 | tidy --drop-empty-elements no -qe ../zig-cache/langref.html | |
| 93 | ||
| 94 | if [ "${BUILD_REASON}" != "PullRequest" ]; then | |
| 95 | # Produce the experimental std lib documentation. | |
| 96 | mkdir -p release/docs/std | |
| 97 | release/bin/zig test ../lib/std/std.zig \ | |
| 98 | --zig-lib-dir ../lib \ | |
| 99 | -femit-docs=release/docs/std \ | |
| 100 | -fno-emit-bin | |
| 101 | ||
| 102 | mv ../LICENSE release/ | |
| 103 | mv ../zig-cache/langref.html release/docs/ | |
| 104 | ||
| 105 | # Remove the unnecessary bin dir in $prefix/bin/zig | |
| 106 | mv release/bin/zig release/ | |
| 107 | rmdir release/bin | |
| 108 | ||
| 109 | # Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig | |
| 110 | mv release/lib/zig release/lib2 | |
| 111 | rmdir release/lib | |
| 112 | mv release/lib2 release/lib | |
| 113 | ||
| 114 | VERSION=$(release/zig version) | |
| 115 | DIRNAME="zig-linux-$ARCH-$VERSION" | |
| 116 | TARBALL="$DIRNAME.tar.xz" | |
| 117 | mv release "$DIRNAME" | |
| 118 | tar cfJ "$TARBALL" "$DIRNAME" | |
| 119 | ||
| 120 | mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg" | |
| 121 | s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ | |
| 122 | ||
| 123 | SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1) | |
| 124 | BYTESIZE=$(wc -c < $TARBALL) | |
| 125 | ||
| 126 | JSONFILE="linux-$GITBRANCH.json" | |
| 127 | touch $JSONFILE | |
| 128 | echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE | |
| 129 | echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE | |
| 130 | echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE | |
| 131 | ||
| 132 | s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE" | |
| 133 | s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$ARCH-linux-$VERSION.json" | |
| 134 | ||
| 135 | # `set -x` causes these variables to be mangled. | |
| 136 | # See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html | |
| 137 | set +x | |
| 138 | echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL" | |
| 139 | echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM" | |
| 140 | echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE" | |
| 141 | echo "##vso[task.setvariable variable=version;isOutput=true]$VERSION" | |
| 142 | fi |
ci/zinc/linux_test.sh+15-15| ... | ... | @@ -7,23 +7,23 @@ ZIG=$DEBUG_STAGING/bin/zig |
| 7 | 7 | $ZIG test test/behavior.zig -fno-stage1 -fLLVM -I test |
| 8 | 8 | $ZIG test test/behavior.zig -fno-stage1 -ofmt=c -I test |
| 9 | 9 | |
| 10 | $ZIG build test-behavior -Denable-qemu -Denable-wasmtime | |
| 11 | $ZIG build test-compiler-rt -Denable-qemu -Denable-wasmtime | |
| 12 | $ZIG build test-std -Denable-qemu -Denable-wasmtime | |
| 13 | $ZIG build test-minilibc -Denable-qemu -Denable-wasmtime | |
| 14 | $ZIG build test-compare-output -Denable-qemu -Denable-wasmtime | |
| 15 | $ZIG build test-standalone -Denable-qemu -Denable-wasmtime | |
| 16 | $ZIG build test-stack-traces -Denable-qemu -Denable-wasmtime | |
| 17 | $ZIG build test-cli -Denable-qemu -Denable-wasmtime | |
| 18 | $ZIG build test-asm-link -Denable-qemu -Denable-wasmtime | |
| 19 | $ZIG build test-runtime-safety -Denable-qemu -Denable-wasmtime | |
| 20 | $ZIG build test-translate-c -Denable-qemu -Denable-wasmtime | |
| 21 | $ZIG build test-run-translated-c -Denable-qemu -Denable-wasmtime | |
| 22 | $ZIG build docs -Denable-qemu -Denable-wasmtime | |
| 10 | $ZIG build test-behavior -fqemu -fwasmtime | |
| 11 | $ZIG build test-compiler-rt -fqemu -fwasmtime | |
| 12 | $ZIG build test-std -fqemu -fwasmtime | |
| 13 | $ZIG build test-minilibc -fqemu -fwasmtime | |
| 14 | $ZIG build test-compare-output -fqemu -fwasmtime | |
| 15 | $ZIG build test-standalone -fqemu -fwasmtime | |
| 16 | $ZIG build test-stack-traces -fqemu -fwasmtime | |
| 17 | $ZIG build test-cli -fqemu -fwasmtime | |
| 18 | $ZIG build test-asm-link -fqemu -fwasmtime | |
| 19 | $ZIG build test-runtime-safety -fqemu -fwasmtime | |
| 20 | $ZIG build test-translate-c -fqemu -fwasmtime | |
| 21 | $ZIG build test-run-translated-c -fqemu -fwasmtime | |
| 22 | $ZIG build docs -fqemu -fwasmtime | |
| 23 | 23 | $ZIG build # test building self-hosted without LLVM |
| 24 | 24 | $ZIG build -Dtarget=arm-linux-musleabihf # test building self-hosted for 32-bit arm |
| 25 | $ZIG build test-fmt -Denable-qemu -Denable-wasmtime | |
| 26 | $ZIG build test-stage2 -Denable-qemu -Denable-wasmtime | |
| 25 | $ZIG build test-fmt -fqemu -fwasmtime | |
| 26 | $ZIG build test-stage2 -fqemu -fwasmtime | |
| 27 | 27 | |
| 28 | 28 | # Produce the experimental std lib documentation. |
| 29 | 29 | mkdir -p $RELEASE_STAGING/docs/std |
lib/std/build.zig+22-27| ... | ... | @@ -70,6 +70,22 @@ pub const Builder = struct { |
| 70 | 70 | args: ?[][]const u8 = null, |
| 71 | 71 | debug_log_scopes: []const []const u8 = &.{}, |
| 72 | 72 | |
| 73 | /// Experimental. Use system Darling installation to run cross compiled macOS build artifacts. | |
| 74 | enable_darling: bool = false, | |
| 75 | /// Use system QEMU installation to run cross compiled foreign architecture build artifacts. | |
| 76 | enable_qemu: bool = false, | |
| 77 | /// Darwin. Use Rosetta to run x86_64 macOS build artifacts on arm64 macOS. | |
| 78 | enable_rosetta: bool = false, | |
| 79 | /// Use system Wasmtime installation to run cross compiled wasm/wasi build artifacts. | |
| 80 | enable_wasmtime: bool = false, | |
| 81 | /// Use system Wine installation to run cross compiled Windows build artifacts. | |
| 82 | enable_wine: bool = false, | |
| 83 | /// After following the steps in https://github.com/ziglang/zig/wiki/Updating-libc#glibc, | |
| 84 | /// this will be the directory $glibc-build-dir/install/glibcs | |
| 85 | /// Given the example of the aarch64 target, this is the directory | |
| 86 | /// that contains the path `aarch64-linux-gnu/lib/ld-linux-aarch64.so.1`. | |
| 87 | glibc_runtimes_dir: ?[]const u8 = null, | |
| 88 | ||
| 73 | 89 | const PkgConfigError = error{ |
| 74 | 90 | PkgConfigCrashed, |
| 75 | 91 | PkgConfigFailed, |
| ... | ... | @@ -1504,27 +1520,6 @@ pub const LibExeObjStep = struct { |
| 1504 | 1520 | /// Permit read-only relocations in read-only segments. Disallowed by default. |
| 1505 | 1521 | link_z_notext: bool = false, |
| 1506 | 1522 | |
| 1507 | /// Uses system Wine installation to run cross compiled Windows build artifacts. | |
| 1508 | enable_wine: bool = false, | |
| 1509 | ||
| 1510 | /// Uses system QEMU installation to run cross compiled foreign architecture build artifacts. | |
| 1511 | enable_qemu: bool = false, | |
| 1512 | ||
| 1513 | /// Uses system Wasmtime installation to run cross compiled wasm/wasi build artifacts. | |
| 1514 | enable_wasmtime: bool = false, | |
| 1515 | ||
| 1516 | /// Experimental. Uses system Darling installation to run cross compiled macOS build artifacts. | |
| 1517 | enable_darling: bool = false, | |
| 1518 | ||
| 1519 | /// Darwin. Uses Rosetta to run x86_64 macOS build artifacts on arm64 macOS. | |
| 1520 | enable_rosetta: bool = false, | |
| 1521 | ||
| 1522 | /// After following the steps in https://github.com/ziglang/zig/wiki/Updating-libc#glibc, | |
| 1523 | /// this will be the directory $glibc-build-dir/install/glibcs | |
| 1524 | /// Given the example of the aarch64 target, this is the directory | |
| 1525 | /// that contains the path `aarch64-linux-gnu/lib/ld-linux-aarch64.so.1`. | |
| 1526 | glibc_multi_install_dir: ?[]const u8 = null, | |
| 1527 | ||
| 1528 | 1523 | /// Position Independent Code |
| 1529 | 1524 | force_pic: ?bool = null, |
| 1530 | 1525 | |
| ... | ... | @@ -2533,13 +2528,13 @@ pub const LibExeObjStep = struct { |
| 2533 | 2528 | } |
| 2534 | 2529 | } else switch (self.target.getExternalExecutor()) { |
| 2535 | 2530 | .native, .unavailable => {}, |
| 2536 | .rosetta => if (self.enable_rosetta) { | |
| 2531 | .rosetta => if (builder.enable_rosetta) { | |
| 2537 | 2532 | try zig_args.append("--test-cmd-bin"); |
| 2538 | 2533 | }, |
| 2539 | .qemu => |bin_name| if (self.enable_qemu) qemu: { | |
| 2534 | .qemu => |bin_name| if (builder.enable_qemu) qemu: { | |
| 2540 | 2535 | const need_cross_glibc = self.target.isGnuLibC() and self.is_linking_libc; |
| 2541 | 2536 | const glibc_dir_arg = if (need_cross_glibc) |
| 2542 | self.glibc_multi_install_dir orelse break :qemu | |
| 2537 | builder.glibc_runtimes_dir orelse break :qemu | |
| 2543 | 2538 | else |
| 2544 | 2539 | null; |
| 2545 | 2540 | try zig_args.append("--test-cmd"); |
| ... | ... | @@ -2567,19 +2562,19 @@ pub const LibExeObjStep = struct { |
| 2567 | 2562 | } |
| 2568 | 2563 | try zig_args.append("--test-cmd-bin"); |
| 2569 | 2564 | }, |
| 2570 | .wine => |bin_name| if (self.enable_wine) { | |
| 2565 | .wine => |bin_name| if (builder.enable_wine) { | |
| 2571 | 2566 | try zig_args.append("--test-cmd"); |
| 2572 | 2567 | try zig_args.append(bin_name); |
| 2573 | 2568 | try zig_args.append("--test-cmd-bin"); |
| 2574 | 2569 | }, |
| 2575 | .wasmtime => |bin_name| if (self.enable_wasmtime) { | |
| 2570 | .wasmtime => |bin_name| if (builder.enable_wasmtime) { | |
| 2576 | 2571 | try zig_args.append("--test-cmd"); |
| 2577 | 2572 | try zig_args.append(bin_name); |
| 2578 | 2573 | try zig_args.append("--test-cmd"); |
| 2579 | 2574 | try zig_args.append("--dir=."); |
| 2580 | 2575 | try zig_args.append("--test-cmd-bin"); |
| 2581 | 2576 | }, |
| 2582 | .darling => |bin_name| if (self.enable_darling) { | |
| 2577 | .darling => |bin_name| if (builder.enable_darling) { | |
| 2583 | 2578 | try zig_args.append("--test-cmd"); |
| 2584 | 2579 | try zig_args.append(bin_name); |
| 2585 | 2580 | try zig_args.append("--test-cmd-bin"); |
lib/std/special/build_runner.zig+41| ... | ... | @@ -142,6 +142,11 @@ pub fn main() !void { |
| 142 | 142 | return usageAndErr(builder, false, stderr_stream); |
| 143 | 143 | }; |
| 144 | 144 | try debug_log_scopes.append(next_arg); |
| 145 | } else if (mem.eql(u8, arg, "--glibc-runtimes")) { | |
| 146 | builder.glibc_runtimes_dir = nextArg(args, &arg_idx) orelse { | |
| 147 | std.debug.print("Expected argument after --glibc-runtimes\n\n", .{}); | |
| 148 | return usageAndErr(builder, false, stderr_stream); | |
| 149 | }; | |
| 145 | 150 | } else if (mem.eql(u8, arg, "--verbose-tokenize")) { |
| 146 | 151 | builder.verbose_tokenize = true; |
| 147 | 152 | } else if (mem.eql(u8, arg, "--verbose-ast")) { |
| ... | ... | @@ -160,6 +165,26 @@ pub fn main() !void { |
| 160 | 165 | builder.verbose_llvm_cpu_features = true; |
| 161 | 166 | } else if (mem.eql(u8, arg, "--prominent-compile-errors")) { |
| 162 | 167 | builder.prominent_compile_errors = true; |
| 168 | } else if (mem.eql(u8, arg, "-fwine")) { | |
| 169 | builder.enable_wine = true; | |
| 170 | } else if (mem.eql(u8, arg, "-fno-wine")) { | |
| 171 | builder.enable_wine = false; | |
| 172 | } else if (mem.eql(u8, arg, "-fqemu")) { | |
| 173 | builder.enable_qemu = true; | |
| 174 | } else if (mem.eql(u8, arg, "-fno-qemu")) { | |
| 175 | builder.enable_qemu = false; | |
| 176 | } else if (mem.eql(u8, arg, "-fwasmtime")) { | |
| 177 | builder.enable_wasmtime = true; | |
| 178 | } else if (mem.eql(u8, arg, "-fno-wasmtime")) { | |
| 179 | builder.enable_wasmtime = false; | |
| 180 | } else if (mem.eql(u8, arg, "-frosetta")) { | |
| 181 | builder.enable_rosetta = true; | |
| 182 | } else if (mem.eql(u8, arg, "-fno-rosetta")) { | |
| 183 | builder.enable_rosetta = false; | |
| 184 | } else if (mem.eql(u8, arg, "-fdarling")) { | |
| 185 | builder.enable_darling = true; | |
| 186 | } else if (mem.eql(u8, arg, "-fno-darling")) { | |
| 187 | builder.enable_darling = false; | |
| 163 | 188 | } else if (mem.eql(u8, arg, "--")) { |
| 164 | 189 | builder.args = argsRest(args, arg_idx); |
| 165 | 190 | break; |
| ... | ... | @@ -233,6 +258,22 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void |
| 233 | 258 | \\ --search-prefix [path] Add a path to look for binaries, libraries, headers |
| 234 | 259 | \\ --libc [file] Provide a file which specifies libc paths |
| 235 | 260 | \\ |
| 261 | \\ -fdarling, -fno-darling Integration with system-installed Darling to | |
| 262 | \\ execute macOS programs on Linux hosts | |
| 263 | \\ (default: no) | |
| 264 | \\ -fqemu, -fno-qemu Integration with system-installed QEMU to execute | |
| 265 | \\ foreign-architecture programs on Linux hosts | |
| 266 | \\ (default: no) | |
| 267 | \\ --glibc-runtimes [path] Enhances QEMU integration by providing glibc built | |
| 268 | \\ for multiple foreign architectures, allowing | |
| 269 | \\ execution of non-native programs that link with glibc. | |
| 270 | \\ -frosetta, -fno-rosetta Rely on Rosetta to execute x86_64 programs on | |
| 271 | \\ ARM64 macOS hosts. (default: no) | |
| 272 | \\ -fwasmtime, -fno-wasmtime Integration with system-installed wasmtime to | |
| 273 | \\ execute WASI binaries. (default: no) | |
| 274 | \\ -fwine, -fno-wine Integration with system-installed Wine to execute | |
| 275 | \\ Windows programs on Linux hosts. (default: no) | |
| 276 | \\ | |
| 236 | 277 | \\ -h, --help Print this help and exit |
| 237 | 278 | \\ --verbose Print commands before executing them |
| 238 | 279 | \\ --color [auto|off|on] Enable or disable colored error messages |
src/test.zig+2-2| ... | ... | @@ -11,7 +11,7 @@ const enable_wine: bool = build_options.enable_wine; |
| 11 | 11 | const enable_wasmtime: bool = build_options.enable_wasmtime; |
| 12 | 12 | const enable_darling: bool = build_options.enable_darling; |
| 13 | 13 | const enable_rosetta: bool = build_options.enable_rosetta; |
| 14 | const glibc_multi_install_dir: ?[]const u8 = build_options.glibc_multi_install_dir; | |
| 14 | const glibc_runtimes_dir: ?[]const u8 = build_options.glibc_runtimes_dir; | |
| 15 | 15 | const skip_compile_errors = build_options.skip_compile_errors; |
| 16 | 16 | const ThreadPool = @import("ThreadPool.zig"); |
| 17 | 17 | const CrossTarget = std.zig.CrossTarget; |
| ... | ... | @@ -1143,7 +1143,7 @@ pub const TestContext = struct { |
| 1143 | 1143 | // TODO Ability for test cases to specify whether to link libc. |
| 1144 | 1144 | const need_cross_glibc = false; // target.isGnuLibC() and self.is_linking_libc; |
| 1145 | 1145 | const glibc_dir_arg = if (need_cross_glibc) |
| 1146 | glibc_multi_install_dir orelse return // glibc dir not available; pass test | |
| 1146 | glibc_runtimes_dir orelse return // glibc dir not available; pass test | |
| 1147 | 1147 | else |
| 1148 | 1148 | null; |
| 1149 | 1149 | try argv.append(qemu_bin_name); |
test/tests.zig-12| ... | ... | @@ -513,12 +513,6 @@ pub fn addPkgTests( |
| 513 | 513 | skip_single_threaded: bool, |
| 514 | 514 | skip_non_native: bool, |
| 515 | 515 | skip_libc: bool, |
| 516 | is_wine_enabled: bool, | |
| 517 | is_qemu_enabled: bool, | |
| 518 | is_wasmtime_enabled: bool, | |
| 519 | is_darling_enabled: bool, | |
| 520 | is_rosetta_enabled: bool, | |
| 521 | glibc_dir: ?[]const u8, | |
| 522 | 516 | ) *build.Step { |
| 523 | 517 | const step = b.step(b.fmt("test-{s}", .{name}), desc); |
| 524 | 518 | |
| ... | ... | @@ -575,12 +569,6 @@ pub fn addPkgTests( |
| 575 | 569 | these_tests.linkSystemLibrary("c"); |
| 576 | 570 | } |
| 577 | 571 | these_tests.overrideZigLibDir("lib"); |
| 578 | these_tests.enable_wine = is_wine_enabled; | |
| 579 | these_tests.enable_qemu = is_qemu_enabled; | |
| 580 | these_tests.enable_wasmtime = is_wasmtime_enabled; | |
| 581 | these_tests.enable_darling = is_darling_enabled; | |
| 582 | these_tests.enable_rosetta = is_rosetta_enabled; | |
| 583 | these_tests.glibc_multi_install_dir = glibc_dir; | |
| 584 | 572 | these_tests.addIncludeDir("test"); |
| 585 | 573 | |
| 586 | 574 | step.dependOn(&these_tests.step); |