configure: cache test output as well

that way we can create a config.log which is consistent with the end
state even if (some) tests are not executed this time around.

Change-Id: Ia953ede62d6640aab912559f435ceb1f9ec6d9dc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Oswald Buddenhagen 2017-12-05 19:58:50 +01:00
parent 0e204c7dc4
commit 2c6801cb37
2 changed files with 39 additions and 5 deletions

View File

@ -23,9 +23,29 @@ QMAKE_MAKE_NAME = $$basename(QMAKE_MAKE)
# Make sure we don't inherit MAKEFLAGS - -i in particular is fatal.
QMAKE_MAKE = "$${SETENV_PFX}MAKEFLAGS=$$SETENV_SFX $$QMAKE_MAKE"
QMAKE_PERSIST_LOG = false
QMAKE_PERSISTED_LOG =
defineTest(qtLog) {
write_file($$QMAKE_CONFIG_LOG, 1, append)
$$QMAKE_CONFIG_VERBOSE: for (l, 1): log("$$l$$escape_expand(\\n)")
$$QMAKE_PERSIST_LOG {
QMAKE_PERSISTED_LOG += $$1
export(QMAKE_PERSISTED_LOG)
}
}
defineTest(qtPersistLog) {
QMAKE_PERSIST_LOG = true
QMAKE_PERSISTED_LOG =
export(QMAKE_PERSIST_LOG)
export(QMAKE_PERSISTED_LOG)
}
defineReplace(qtPersistedLog) {
QMAKE_PERSIST_LOG = false
export(QMAKE_PERSIST_LOG)
return($$QMAKE_PERSISTED_LOG)
}
defineTest(qtRunLoggedCommand) {

View File

@ -710,13 +710,14 @@ defineTest(qtConfHandleLibrary) {
}
use_args = $$eval($${lpfx}.literal_args)
qtConfLoadResult($${lpfx}, $$1) {
qtConfLoadResult($${lpfx}, $$1, "library") {
$$eval($${lpfx}.result): \
qtConfExportLibrary($$1)
return()
}
qtLogTestIntro($${lpfx}, "looking for library $${1}")
qtPersistLog()
result = false
for (s, $${lpfx}.sources._KEYS_) {
@ -768,6 +769,9 @@ defineTest(qtConfHandleLibrary) {
break()
}
$${lpfx}.msgs = $$qtPersistedLog()
export($${lpfx}.msgs)
qtLogTestResult($${lpfx}, $$result)
$${lpfx}.result = $$result
@ -1023,7 +1027,7 @@ defineTest(qtLogTestIntro) {
label = $$eval($${1}.label)
isEmpty(label): return()
log("Checking for $${label}... ")
isEmpty(3): log("Checking for $${label}... ")
$$QMAKE_CONFIG_VERBOSE: log("$$escape_expand(\\n)")
write_file($$QMAKE_CONFIG_LOG, 2, append)
}
@ -1043,14 +1047,14 @@ defineTest(qtLogTestResult) {
msg = "test $$1 FAILED"
}
$$QMAKE_CONFIG_VERBOSE: log_msg = $$msg
logn("$$log_msg")
isEmpty(3): logn("$$log_msg")
write_file($$QMAKE_CONFIG_LOG, msg, append)
}
defineTest(qtConfSaveResult) {
equals($${1}.cache, -): \
return()
keys = result $$eval($${1}.cache)
keys = result msgs $$eval($${1}.cache)
cont = "cache.$${2}._KEYS_ = $$keys"
cache.$${2}._KEYS_ = $$keys
export(cache.$${2}._KEYS_)
@ -1073,6 +1077,12 @@ defineTest(qtConfLoadResult) {
$${1}.$${k} = $$eval(cache.$${2}.$${k})
export($${1}.$${k})
}
# we could print the cached result, but that's basically just noise -
# the explicitly generated summary is supposed to contain all relevant
# information.
qtLogTestIntro($$1, "loaded result for $$3 $$1", false)
qtLog($$eval($${1}.msgs))
qtLogTestResult($$1, $$eval($${1}.result), false)
return(true)
}
@ -1153,14 +1163,18 @@ defineTest(qtRunSingleTest) {
# note: we do this only after resolving the dependencies and the
# preparation (which may resolve libraries), so that caching does
# not alter the execution order (and thus the output).
qtConfLoadResult($${tpfx}, $$1): \
qtConfLoadResult($${tpfx}, $$1, "config test"): \
return()
qtLogTestIntro($${tpfx}, "executing config test $${1}")
qtPersistLog()
result = false
$${call}($${tpfx}): result = true
$${tpfx}.msgs = $$qtPersistedLog()
export($${tpfx}.msgs)
qtLogTestResult($${tpfx}, $$result)
$${tpfx}.result = $$result