Skip to content

Commit 0cc3968

Browse files
committed
test(ci): carry Windows rename probe through supervisor log
1 parent d210c9c commit 0cc3968

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎src/build/schedule/compiler_transaction.cpp‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ bool replace_record(const fs::path& path,std::string_view bytes,std::string* dia
3232
std::error_code sourceError, targetError;
3333
const auto source=fs::symlink_status(temporary,sourceError);
3434
const auto target=fs::symlink_status(path,targetError);
35+
std::string probeReport;
3536
// A final status is a new name. If the replace form itself was
3637
// refused as invalid while that name is absent, try the atomic
3738
// no-replace form on the exact same source and destination. Its
@@ -60,18 +61,18 @@ bool replace_record(const fs::path& path,std::string_view bytes,std::string* dia
6061
std::error_code nativeError;
6162
fs::rename(temporary,probe,nativeError);
6263
if(!nativeError) {std::error_code ignored;fs::remove(probe,ignored);}
63-
std::println(std::cerr,
64-
"mcpp: CI rename probe source-rel {} target-rel {} same-root {} KAL-read {} std-rename-code {} category {}",
64+
probeReport=std::format(
65+
"; CI probe source-rel {} target-rel {} same-root {} KAL-read {} std-rename-code {} category {}",
6566
sourceLocation?sourceLocation->relative.size():0,
6667
targetLocation?targetLocation->relative.size():0,
6768
sourceLocation&&targetLocation&&sourceLocation->directory==targetLocation->directory,
6869
readable?0:static_cast<int>(readable.error().code),
6970
nativeError.value(),nativeError.category().name());
7071
}
7172
#endif
72-
*diagnostic=std::format("rename temporary (condition {}, native {}; source regular {} ec {}; target exists {} ec {}; no-replace condition {})",
73+
*diagnostic=std::format("rename temporary (condition {}, native {}; source regular {} ec {}; target exists {} ec {}; no-replace condition {}{})",
7374
static_cast<int>(renamed.error().code),renamed.error().native,
74-
fs::is_regular_file(source),sourceError.value(),fs::exists(target),targetError.value(),noReplaceCode);
75+
fs::is_regular_file(source),sourceError.value(),fs::exists(target),targetError.value(),noReplaceCode,probeReport);
7576
}
7677
} else if(!written) {
7778
fail("write/flush temporary");

‎src/build/schedule/detach_codegen.cppm‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ std::optional<int> read_rc(const std::filesystem::path& slot) {
312312

313313
// Temp file + rename, so a reader never observes half a number. The same
314314
// guarantee, for the same reason, that makes watching the BMI path sound.
315+
void record_supervisor_error(const std::filesystem::path& slot,std::string_view reason);
315316
bool write_rc(const std::filesystem::path& slot, int rc,std::string* diagnostic=nullptr) {
316317
std::string localDiagnostic;
317318
auto* detail=diagnostic?diagnostic:&localDiagnostic;
@@ -320,7 +321,7 @@ bool write_rc(const std::filesystem::path& slot, int rc,std::string* diagnostic=
320321
// CI-only: early supervisor failures have no caller-owned diagnostic.
321322
// Report their status-publication failure without printing private paths.
322323
if(!written&&!diagnostic)
323-
std::println(std::cerr,"mcpp: CI early status publication: {}",localDiagnostic);
324+
record_supervisor_error(slot,std::format("CI early status publication: {}",localDiagnostic));
324325
#endif
325326
return written;
326327
}

0 commit comments

Comments
 (0)