[autotest] Enable log_diff for server side test.
The bug was introduced when we try to force to collect all logs if a test
failed, refer to CL:
https://chromium-review.googlesource.com/#/c/174058
For server side test, the success flag does not pass to the code to run
log_after_each_test, thus all logs are collected by default.
The fix is to add a line of code in _sysinfo_after_test_script to pass the
flag mytest.success to the script to run on the dut.
Also update dummy_FailServer to be consistent on naming.
BUG=chromium:386242
TEST=test_that 172.22.30.146 dummy_PassServer
confirm only the log diff is collected:
/tmp/test_that_results_8Xj6Qj/results-1-dummy_PassServer/dummy_PassServer/sysinfo/var/log_diff/
test_that 172.22.30.146 dummy_FailServer
confirm the full log is collected:
/tmp/test_that_results_iAOAfZ/results-1-dummy_FailServer/dummy_FailServer/sysinfo/var/log/
Change-Id: Icec189c1c0d05ece11d41c68517b6671193a9cd9
Reviewed-on: https://chromium-review.googlesource.com/204488
Reviewed-by: Dan Shi <[email protected]>
Commit-Queue: Dan Shi <[email protected]>
Tested-by: Dan Shi <[email protected]>
diff --git a/server/site_tests/dummy_FailServer/control b/server/site_tests/dummy_FailServer/control
index b89e836..55f48a9 100644
--- a/server/site_tests/dummy_FailServer/control
+++ b/server/site_tests/dummy_FailServer/control
@@ -1,4 +1,4 @@
-NAME = 'Flaky server side test'
+NAME = 'dummy_FailServer'
AUTHOR = 'scottz'
TIME = 'SHORT'
TEST_CATEGORY = 'Functional'
@@ -10,9 +10,8 @@
Test that always fails.
"""
-from autotest_lib.client.common_lib import utils
def run(machine):
host = hosts.create_host(machine)
- job.run_test('dummy_Fail', disable_sysinfo=True)
+ job.run_test('dummy_FailServer', disable_sysinfo=False)
job.parallel_simple(run, machines)
diff --git a/server/site_tests/dummy_FailServer/control.retry_failfast b/server/site_tests/dummy_FailServer/control.retry_failfast
index c659463..ded8065 100644
--- a/server/site_tests/dummy_FailServer/control.retry_failfast
+++ b/server/site_tests/dummy_FailServer/control.retry_failfast
@@ -1,4 +1,4 @@
-NAME = 'Flaky server side test'
+NAME = 'dummy_FailServer_Flaky'
AUTHOR = 'scottz'
TIME = 'SHORT'
TEST_CATEGORY = 'Functional'
@@ -16,6 +16,6 @@
from autotest_lib.client.common_lib import utils
def run(machine):
host = hosts.create_host(machine)
- job.run_test('dummy_Fail', disable_sysinfo=True)
+ job.run_test('dummy_FailServer', disable_sysinfo=True)
job.parallel_simple(run, machines)
diff --git a/server/site_tests/dummy_FailServer/dummy_Fail.py b/server/site_tests/dummy_FailServer/dummy_FailServer.py
similarity index 92%
rename from server/site_tests/dummy_FailServer/dummy_Fail.py
rename to server/site_tests/dummy_FailServer/dummy_FailServer.py
index a750e21..738b9d4 100644
--- a/server/site_tests/dummy_FailServer/dummy_Fail.py
+++ b/server/site_tests/dummy_FailServer/dummy_FailServer.py
@@ -5,7 +5,7 @@
from autotest_lib.server import test
from autotest_lib.client.common_lib import error
-class dummy_Fail(test.test):
+class dummy_FailServer(test.test):
"""A test that always fails."""
version = 1
diff --git a/server/test.py b/server/test.py
index 8fdba9d7..c184d65 100644
--- a/server/test.py
+++ b/server/test.py
@@ -27,6 +27,9 @@
import pickle
from autotest_lib.client.bin import test
mytest = test.test(job, '', %r)
+# success is passed in so diffable_logdir can decide if or not to collect
+# full log content.
+mytest.success = %s
sysinfo_pickle = os.path.join(mytest.outputdir, 'sysinfo.pickle')
if os.path.exists(sysinfo_pickle):
job.sysinfo = pickle.load(open(sysinfo_pickle))
@@ -200,7 +203,7 @@
def after_hook(self, mytest, host, at, outputdir):
self._push_pickle(host, outputdir);
# run the post-test sysinfo script
- at.run(_sysinfo_after_test_script % outputdir,
+ at.run(_sysinfo_after_test_script % (outputdir, mytest.success),
results_dir=self.job.resultdir)
self._pull_sysinfo_keyval(host, outputdir, mytest)