Skip to content

Commit efe2e02

Browse files
committed
test(ci): isolate Windows status rename failure
1 parent e5bb727 commit efe2e02

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

‎.github/workflows/cross-build-test.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ jobs:
529529
shell: bash
530530
run: |
531531
export MCPP_VENDORED_XLINGS="$XLINGS_BIN"
532+
export MCPP_TEST_NATIVE_RENAME=1 # CI-only diagnosis; remove before release
532533
"$MCPP_SELF" build --target x86_64-linux-musl
533534
# Scope the search to the TARGET's output tree — target/ also holds the
534535
# host build from the previous step, and both are named "mcpp*".

‎src/build/schedule/compiler_transaction.cpp‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,28 @@ bool replace_record(const fs::path& path,std::string_view bytes,std::string* dia
4848
}
4949
noReplaceCode=static_cast<int>(noReplace.error().code);
5050
}
51+
#if defined(_WIN32)
52+
// CI-only root-cause probe. Remove before merge: it intentionally
53+
// compares the standard library's rename of this exact source to
54+
// a distinct diagnostic name, without publishing the status.
55+
if(noReplaceCode==static_cast<int>(os::errc::invalid)
56+
&& std::getenv("MCPP_TEST_NATIVE_RENAME")!=nullptr) {
57+
const auto sourceLocation=os::fs::locate(temporary);
58+
const auto targetLocation=os::fs::locate(path);
59+
const auto readable=os::fs::read(temporary);
60+
auto probe=temporary;probe+=".diagnostic";
61+
std::error_code nativeError;
62+
fs::rename(temporary,probe,nativeError);
63+
if(!nativeError) {std::error_code ignored;fs::remove(probe,ignored);}
64+
std::println(std::cerr,
65+
"mcpp: CI rename probe source-rel {} target-rel {} same-root {} KAL-read {} std-rename-code {} category {}",
66+
sourceLocation?sourceLocation->relative.size():0,
67+
targetLocation?targetLocation->relative.size():0,
68+
sourceLocation&&targetLocation&&sourceLocation->directory==targetLocation->directory,
69+
readable?0:static_cast<int>(readable.error().code),
70+
nativeError.value(),nativeError.category().name());
71+
}
72+
#endif
5173
*diagnostic=std::format("rename temporary (condition {}, native {}; source regular {} ec {}; target exists {} ec {}; no-replace condition {})",
5274
static_cast<int>(renamed.error().code),renamed.error().native,
5375
fs::is_regular_file(source),sourceError.value(),fs::exists(target),targetError.value(),noReplaceCode);

0 commit comments

Comments
 (0)