From eca58b56da3eea930c78af913fc15c7607a32d0a Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 8 Apr 2026 09:26:51 +0800 Subject: Update test.lua --- .../modules/reuse_strict_private_defines/test.lua | 34 ++++++++++++---------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/tests/projects/c++/modules/reuse_strict_private_defines/test.lua b/tests/projects/c++/modules/reuse_strict_private_defines/test.lua index 4405d6e47..aeaf2cf10 100644 --- a/tests/projects/c++/modules/reuse_strict_private_defines/test.lua +++ b/tests/projects/c++/modules/reuse_strict_private_defines/test.lua @@ -13,26 +13,30 @@ function _build() if ci_is_running() then flags = "-vD" end - local outdata = os.iorun("xmake -r " .. flags) local leaked = false local missing_sysincludedir = true - for line in outdata:gmatch("[^\r\n]+") do - if line:find("Consumer", 1, true) then - if line:find(PRIVATE_DEFINE, 1, true) then - leaked = true - end - if line:find(PUBLIC_SYSINCLUDEDIR, 1, true) then - missing_sysincludedir = false + local outdata = try { function () return os.iorun("xmake -rv") end } + if outdata then + for line in outdata:gmatch("[^\r\n]+") do + if line:find("Consumer", 1, true) then + if line:find(PRIVATE_DEFINE, 1, true) then + leaked = true + end + if line:find(PUBLIC_SYSINCLUDEDIR, 1, true) then + missing_sysincludedir = false + end end end + if leaked then + raise("Private dependency defines leaked into Consumer module rebuilds under reuse.strict\n%s", outdata) + end + if missing_sysincludedir then + raise("Missing public sysincludedir in Consumer module rebuilds under reuse.strict\n%s", outdata) + end + else + -- maybe build failed, we need to see verbose errors + os.run("xmake " .. flags) end - if leaked then - raise("Private dependency defines leaked into Consumer module rebuilds under reuse.strict\n%s", outdata) - end - if missing_sysincludedir then - raise("Missing public sysincludedir in Consumer module rebuilds under reuse.strict\n%s", outdata) - end - os.run("xmake " .. flags) end function main(_) -- cgit v1.3.1