Skip to content

Commit 5a17553

Browse files
committed
e2e 1116: the SDK check reads the build's commands, not the probe's description of the host
1 parent 954d30d commit 5a17553

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎tests/e2e/targets/rows.cpp‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,16 @@ int main() {
399399
expect(fatal(bytes.starts_with("\x7f" "ELF"))) << "the program is not an ELF";
400400
const bool freebsd = (bytes.size() > 7 && bytes[7] == 9) || bytes.contains(std::string_view("FreeBSD\0", 8));
401401
expect(freebsd) << "the ELF is not a FreeBSD program";
402-
expect(s::lacks(s::text(r), "MacOSX") && s::lacks(s::text(r), "-isysroot")) << "the build names an SDK of the host: " << s::text(r);
402+
// No command of the build names an SDK of the host. The probe of the toolchain's
403+
// own compiler reports the host's SDK in the verbose log (`probe: sysroot`) before
404+
// any command is written; that line is the host's description and reaches none.
405+
const std::string log = s::text(r);
406+
bool sdk = log.contains("-isysroot");
407+
for (auto line : std::views::split(log, '\n')) {
408+
const std::string_view l(line.begin(), line.end());
409+
sdk = sdk || (l.contains("MacOSX") && !l.contains("probe: "));
410+
}
411+
expect(!sdk) << "a command of the build names an SDK of the host: " << s::text(r);
403412
};
404413

405414
"1118 a platform's system states what its rows share"_test[s::llvm] = [] {

0 commit comments

Comments
 (0)