authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-11 00:46:44-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-11 00:46:44-07:00
log9f1f60fd4311b37493a5297ccaac167d0270f521
tree479e128fd7f823745d68443d87cd3ea0c5c57667
parent933436dc52b9be0a3e5d81b014fba6df2124fe20

test-cases: remove multi-threading

This effectively reverts 22690efcc2378222503cb8aaad26a6f4a539f5aa, re-opening #11818. This had the following problems: * Buggy on some targets (macOS, Windows) * Messy output to the terminal These problems need to be solved before moving forward with this.

1 files changed, 8 insertions(+), 40 deletions(-)

src/test.zig+8-40
......@@ -1224,10 +1224,6 @@ pub const TestContext = struct {
12241224 try aux_thread_pool.init(self.gpa);
12251225 defer aux_thread_pool.deinit();
12261226
1227 var case_thread_pool: ThreadPool = undefined;
1228 try case_thread_pool.init(self.gpa);
1229 defer case_thread_pool.deinit();
1230
12311227 // Use the same global cache dir for all the tests, such that we for example don't have to
12321228 // rebuild musl libc for every case (when LLVM backend is enabled).
12331229 var global_tmp = std.testing.tmpDir(.{});
......@@ -1245,9 +1241,6 @@ pub const TestContext = struct {
12451241 defer self.gpa.free(global_cache_directory.path.?);
12461242
12471243 {
1248 var wait_group: WaitGroup = .{};
1249 defer wait_group.wait();
1250
12511244 for (self.cases.items) |*case| {
12521245 if (build_options.skip_non_native) {
12531246 if (case.target.getCpuArch() != builtin.cpu.arch)
......@@ -1267,17 +1260,19 @@ pub const TestContext = struct {
12671260 if (std.mem.indexOf(u8, case.name, test_filter) == null) continue;
12681261 }
12691262
1270 wait_group.start();
1271 try case_thread_pool.spawn(workerRunOneCase, .{
1263 var prg_node = root_node.start(case.name, case.updates.items.len);
1264 prg_node.activate();
1265 defer prg_node.end();
1266
1267 case.result = runOneCase(
12721268 self.gpa,
1273 root_node,
1274 case,
1269 &prg_node,
1270 case.*,
12751271 zig_lib_directory,
12761272 &aux_thread_pool,
12771273 global_cache_directory,
12781274 host,
1279 &wait_group,
1280 });
1275 );
12811276 }
12821277 }
12831278
......@@ -1295,33 +1290,6 @@ pub const TestContext = struct {
12951290 }
12961291 }
12971292
1298 fn workerRunOneCase(
1299 gpa: Allocator,
1300 root_node: *std.Progress.Node,
1301 case: *Case,
1302 zig_lib_directory: Compilation.Directory,
1303 thread_pool: *ThreadPool,
1304 global_cache_directory: Compilation.Directory,
1305 host: std.zig.system.NativeTargetInfo,
1306 wait_group: *WaitGroup,
1307 ) void {
1308 defer wait_group.finish();
1309
1310 var prg_node = root_node.start(case.name, case.updates.items.len);
1311 prg_node.activate();
1312 defer prg_node.end();
1313
1314 case.result = runOneCase(
1315 gpa,
1316 &prg_node,
1317 case.*,
1318 zig_lib_directory,
1319 thread_pool,
1320 global_cache_directory,
1321 host,
1322 );
1323 }
1324
13251293 fn runOneCase(
13261294 allocator: Allocator,
13271295 root_node: *std.Progress.Node,