╭ changed ───────╮ │src/test/net.zig│ ╰────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────╮ │← previous│ ╰──────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1275 io: std.Io, │ │1276 allocator: std.mem.Allocator, │ │1277 ) !void { │ │1337 - const temp_dir_name = "temp-testnet-fetch-large"; │ │1338 - │ │1278 // create the temp dir │ │1340 - const cwd = std.Io.Dir.cwd(); │ │1341 - var temp_dir_or_err = cwd.openDir(io, temp_dir_name, .{}); │ │1342 - if (temp_dir_or_err) |*temp_dir| { │ │1343 - temp_dir.close(io); │ │1344 - try cwd.deleteTree(io, temp_dir_name); │ │1345 - } else |_| {} │ │1346 - var temp_dir = try cwd.createDirPathOpen(io, temp_dir_name, .{}); │ │1347 - defer cwd.deleteTree(io, temp_dir_name) catch {}; │ │1348 - defer temp_dir.close(io); │ │1279 + var temp = std.testing.tmpDir(.{}); │ │1280 + defer temp.cleanup(); │ │1281 + const temp_path = try temp.dir.realPathFileAlloc(io, ".", allocator); │ │1282 + defer allocator.free(temp_path); │ │1283 │ │1284 // init server │ │1351 - var server_process = try runServer(io, allocator, temp_dir_name, port); │ │1285 + var server_process = try runServer(io, allocator, temp_path, port); │ │1286 defer _ = server_process.kill(io); │ │1353 - │ │1354 - const cwd_path = try std.process.currentPathAlloc(io, allocator); │ │1355 - defer allocator.free(cwd_path); │ │1287 │ │1288 // register the repo under admin and locate its on-disk directory │ │1358 - const server_path = (try repoOnDiskPath(io, allocator, temp_dir_name, "testrepo", true)).?; │ │1289 + const server_path = (try repoOnDiskPath(io, allocator, temp_path, "testrepo", true)).?; │ │1290 defer allocator.free(server_path); │ │1291 │ │1292 var server_repo = try rp.Repo(.xit, .{ .is_test = true }).init(io, allocator, .{ .bare = true, .path = server_path });│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1305 try server_repo.addConfig(io, allocator, .{ .name = "uploadpack.allowrefinwant", .value = "true" }); │ │1306 } │ │1307 │ │1377 - const client_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "client" }); │ │1308 + const client_path = try std.fs.path.join(allocator, &.{ temp_path, "client" }); │ │1309 defer allocator.free(client_path); │ │1310 │ │1311 var client_repo = try rp.Repo(repo_kind, .{ .is_test = true }).init(io, allocator, .{ .path = client_path });│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1326 }; │ │1327 │ │1328 if (shell_out_to_git) { │ │1398 - const priv_key_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "key" }); │ │1329 + const priv_key_path = try std.fs.path.join(allocator, &.{ temp_path, "key" }); │ │1330 defer allocator.free(priv_key_path); │ │1331 const ssh_config_arg = try std.fmt.allocPrint(allocator, "core.sshCommand=ssh -p {} -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile={s}", .{ port + 1, priv_key_path });│ │1332 defer allocator.free(ssh_config_arg); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1385 "+refs/heads/master:refs/heads/master", │ │1386 }; │ │1387 │ │1457 - const ssh_cmd_maybe = try sshCommand(is_ssh, allocator, cwd_path, temp_dir_name, port);│ │1388 + const ssh_cmd_maybe = try sshCommand(is_ssh, allocator, temp_path, port); │ │1389 defer if (ssh_cmd_maybe) |ssh_cmd| allocator.free(ssh_cmd); │ │1390 │ │1391 try client_repo.fetch( │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1416 io: std.Io, │ │1417 allocator: std.mem.Allocator, │ │1418 ) !void { │ │1488 - const temp_dir_name = "temp-testnet-push-large"; │ │1489 - │ │1419 // create the temp dir │ │1491 - const cwd = std.Io.Dir.cwd(); │ │1492 - var temp_dir_or_err = cwd.openDir(io, temp_dir_name, .{}); │ │1493 - if (temp_dir_or_err) |*temp_dir| { │ │1494 - temp_dir.close(io); │ │1495 - try cwd.deleteTree(io, temp_dir_name); │ │1496 - } else |_| {} │ │1497 - var temp_dir = try cwd.createDirPathOpen(io, temp_dir_name, .{}); │ │1498 - defer cwd.deleteTree(io, temp_dir_name) catch {}; │ │1499 - defer temp_dir.close(io); │ │1420 + var temp = std.testing.tmpDir(.{}); │ │1421 + defer temp.cleanup(); │ │1422 + const temp_path = try temp.dir.realPathFileAlloc(io, ".", allocator); │ │1423 + defer allocator.free(temp_path); │ │1424 │ │1425 // init server │ │1502 - var server_process = try runServer(io, allocator, temp_dir_name, port); │ │1426 + var server_process = try runServer(io, allocator, temp_path, port); │ │1427 defer _ = server_process.kill(io); │ │1428 │ │1505 - const cwd_path = try std.process.currentPathAlloc(io, allocator); │ │1506 - defer allocator.free(cwd_path); │ │1507 - │ │1429 // register the repo under admin and locate its on-disk directory │ │1509 - const server_path = (try repoOnDiskPath(io, allocator, temp_dir_name, "testrepo", true)).?; │ │1430 + const server_path = (try repoOnDiskPath(io, allocator, temp_path, "testrepo", true)).?; │ │1431 defer allocator.free(server_path); │ │1432 │ │1433 var server_repo = try rp.Repo(.xit, .{ .is_test = true }).init(io, allocator, .{ .bare = true, .path = server_path });│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1442 defer export_file.close(io); │ │1443 } │ │1444 │ │1524 - const client_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "client" }); │ │1445 + const client_path = try std.fs.path.join(allocator, &.{ temp_path, "client" }); │ │1446 defer allocator.free(client_path); │ │1447 │ │1448 var client_repo = try rp.Repo(repo_kind, .{ .is_test = true }).init(io, allocator, .{ .path = client_path });│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────╮ │1449 defer client_repo.deinit(io, allocator); │ │1450 │ │1530 - var client_dir = try cwd.openDir(io, client_path, .{}); │ │1451 + var client_dir = try temp.dir.openDir(io, "client", .{});│ │1452 defer client_dir.close(io); │ │1453 │ │1454 { │ ╰───────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │1459 } │ │1460 │ │1461 // copy files from current repo into client dir │ │1462 + const cwd = std.Io.Dir.cwd(); │ │1463 for (&[_][]const u8{"src"}) |dir_name| { │ │1464 var src_repo_dir = try cwd.openDir(io, dir_name, .{ .iterate = true });│ │1465 defer src_repo_dir.close(io); │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1514 }; │ │1515 │ │1516 if (shell_out_to_git) { │ │1595 - const priv_key_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "key" }); │ │1517 + const priv_key_path = try std.fs.path.join(allocator, &.{ temp_path, "key" }); │ │1518 defer allocator.free(priv_key_path); │ │1519 const ssh_config_arg = try std.fmt.allocPrint(allocator, "core.sshCommand=ssh -p {} -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile={s}", .{ port + 1, priv_key_path });│ │1520 defer allocator.free(ssh_config_arg); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1535 return error.GitCommandFailed; │ │1536 } │ │1537 } else { │ │1616 - const ssh_cmd_maybe = try sshCommand(is_ssh, allocator, cwd_path, temp_dir_name, port);│ │1538 + const ssh_cmd_maybe = try sshCommand(is_ssh, allocator, temp_path, port); │ │1539 defer if (ssh_cmd_maybe) |ssh_cmd| allocator.free(ssh_cmd); │ │1540 │ │1541 try client_repo.push( │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯