Skip to content

Commit 5b2a57a

Browse files
Merge pull request #211 from firebase/feature/aks-gtest-logging
Change integration test log level to "debug"
2 parents 1e2dd0e + 1e75486 commit 5b2a57a

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

scripts/gha/desktop_tester.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,27 @@ class Test(object):
9494
# them as fields so they can be accessed from the main thread.
9595
def run(self):
9696
"""Executes this testapp."""
97-
result = subprocess.run(
98-
args=[self.testapp_path],
99-
cwd=os.path.dirname(self.testapp_path), # Testapp checks CWD for config
100-
stdout=subprocess.PIPE,
101-
stderr=subprocess.STDOUT,
102-
text=True,
103-
check=False,
104-
timeout=300)
97+
result = None # Ensures this var is defined if timeout occurs.
98+
try:
99+
result = subprocess.run(
100+
args=[self.testapp_path],
101+
cwd=os.path.dirname(self.testapp_path), # Testapp uses CWD for config
102+
stdout=subprocess.PIPE,
103+
stderr=subprocess.STDOUT,
104+
text=True,
105+
check=False,
106+
timeout=300)
107+
except subprocess.TimeoutExpired as e:
108+
logging.error("Testapp timed out!")
109+
# e.output will sometimes be bytes, sometimes string. Decode if needed.
110+
try:
111+
self.logs = e.output.decode()
112+
except AttributeError: # This will happen if it's already a string.
113+
self.logs = e.output
114+
if result:
115+
self.logs = result.stdout
105116
logging.info("Finished running %s", self.testapp_path)
106117

107-
self.logs = result.stdout
108-
self.return_code = result.returncode
109-
110118

111119
if __name__ == "__main__":
112120
app.run(main)

testing/test_framework/src/firebase_test_framework.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ std::ostream& operator<<(std::ostream& os, const Variant& v) {
208208
extern "C" int common_main(int argc, char* argv[]) {
209209
::testing::InitGoogleTest(&argc, argv);
210210
firebase_test_framework::FirebaseTest::SetArgs(argc, argv);
211-
app_framework::SetLogLevel(app_framework::kInfo);
211+
app_framework::SetLogLevel(app_framework::kDebug);
212212
// Anything below the given log level will be preserved, and printed out in
213213
// the event of test failure.
214214
app_framework::SetPreserveFullLog(true);

0 commit comments

Comments
 (0)