Skip to content

Commit b58066f

Browse files
authored
bin(run): specify -target for zig test (#71)
Four recent commits [1][2][3][4] tried to speed up running user solutions in production, but weren't sufficient. Continue trying. With Exercism's test runner architecture, the x86_64 CPU that creates the cache is likely to have different features than the x86_64 CPU that runs `zig test` in production. If that meant that Zig couldn't use the cache, this commit might help. This commit produces the below diff to a `builtin.zig` file in a `/home/ziggy/.cache/zig/o/` subdirectory in the image. Note the reduced set of CPU features. @@ -12,66 +12,22 @@ pub const single_threaded = false; pub const abi = std.Target.Abi.musl; pub const cpu: std.Target.Cpu = .{ .arch = .x86_64, - .model = &std.Target.x86.cpu.icelake_server, + .model = &std.Target.x86.cpu.x86_64, .features = std.Target.x86.featureSet(&[_]std.Target.x86.Feature{ .@"64bit", - .adx, - .aes, - .allow_light_256_bit, - .avx, - .avx2, - .avx512bw, - .avx512cd, - .avx512dq, - .avx512f, - .avx512vl, - .bmi, - .bmi2, - .clflushopt, .cmov, - .crc32, - .cx16, .cx8, - .ermsb, - .f16c, - .fast_15bytenop, - .fast_gather, - .fast_scalar_fsqrt, - .fast_shld_rotate, - .fast_variable_crosslane_shuffle, - .fast_variable_perlane_shuffle, - .fast_vector_fsqrt, - .fma, - .fsgsbase, - .fsrm, .fxsr, .idivq_to_divl, - .invpcid, - .lzcnt, .macrofusion, .mmx, - .movbe, .nopl, - .pclmul, - .popcnt, - .prefer_256_bit, - .prfchw, - .rdrnd, - .rdseed, - .rtm, - .sahf, + .slow_3ops_lea, + .slow_incdec, .sse, .sse2, - .sse3, - .sse4_1, - .sse4_2, - .ssse3, .vzeroupper, .x87, - .xsave, - .xsavec, - .xsaveopt, - .xsaves, }), }; pub const os = std.Target.Os{ @@ -79,14 +35,14 @@ pub const os = std.Target.Os{ .version_range = .{ .linux = .{ .range = .{ .min = .{ - .major = 5, - .minor = 15, + .major = 3, + .minor = 16, .patch = 0, }, .max = .{ .major = 5, - .minor = 15, - .patch = 0, + .minor = 10, + .patch = 81, }, }, Refs: #63 [1] 82b56af, 2023-08-23, ".dockerignore, Dockerfile: add a zig cache" [2] b8b9d02, 2023-08-27, "Dockerfile, bin(run-tests), tests: set USER" [3] 3f2c0c2, 2023-08-27, "Dockerfile: create zig cache later" [4] 0636420, 2023-08-27, "Dockerfile: create zig cache via run.sh, not zig test"
1 parent 0636420 commit b58066f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

bin/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ cd "${solution_dir}" || exit 1
3737

3838
# Run the tests for the provided implementation file and redirect stdout and
3939
# stderr to capture it
40-
test_output=$(zig test "${test_file}" 2>&1)
40+
test_output=$(zig test -target x86_64-linux-musl "${test_file}" 2>&1)
4141
exit_code=$?
4242

4343
cd "${start_dir}" || exit 1

0 commit comments

Comments
 (0)