[autotest] Fixes for 'Create Job' page when using 'Fetch Tests from Build'
'Fetch Tests from Build' correctly populated the test selector with
the tests supported by the provided image, however, when communicating
with the backend, default test information from the database was being
used. This resulted in the wrong control file being used for the
selected test. In addition, the get_tests_by_build rpc reponse was
missing information required by certain AFE functions, this resulted
in the auto-selection for hostless jobs to break when fetching tests
for an image.
This CL makes it so that when tests are fetched for a particular image,
client state describing the control file is used to find/build
the control file rather than pulling from the default test database.
It also corrects the get_tests_by_build rpc so that the missing
attributes are provided.
BUG=chromium:503385,chromium:503731
DEPLOY=afe
TEST=Tested changes on a moblab.
Change-Id: I54739a4bb6e96cd2517ea59dc0a937d0d81cc000
Reviewed-on: https://chromium-review.googlesource.com/281760
Tested-by: Matthew Sartori <msartori@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Matthew Sartori <msartori@chromium.org>
diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index 2af5783..37050bf 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -646,11 +646,12 @@
def generate_control_file(tests=(), kernel=None, label=None, profilers=(),
client_control_file='', use_container=False,
- profile_only=None, upload_kernel_config=False):
+ profile_only=None, upload_kernel_config=False,
+ db_tests=True):
"""
Generates a client-side control file to load a kernel and run tests.
- @param tests List of tests to run.
+ @param tests List of tests to run. See db_tests for more information.
@param kernel A list of kernel info dictionaries configuring which kernels
to boot for this job and other options for them
@param label Name of label to grab kernel config from.
@@ -671,6 +672,11 @@
file code that uploads the kernel config file to the client and
tells the client of the new (local) path when compiling the kernel;
the tests must be server side tests
+ @param db_tests: if True, the test object can be found in the database
+ backing the test model. In this case, tests is a tuple
+ of test IDs which are used to retrieve the test objects
+ from the database. If False, tests is a tuple of test
+ dictionaries stored client-side in the AFE.
@returns a dict with the following keys:
control_file: str, The control file text.
@@ -685,7 +691,7 @@
cf_info, test_objects, profiler_objects, label = (
rpc_utils.prepare_generate_control_file(tests, kernel, label,
- profilers))
+ profilers, db_tests))
cf_info['control_file'] = control_file.generate_control(
tests=test_objects, kernels=kernel, platform=label,
profilers=profiler_objects, is_server=cf_info['is_server'],