blob: f49aedb4dda4e94e6b346fed65a6c4428d03bad6 [file] [log] [blame]
Mike Truty2b2cafc2010-04-05 14:30:15 -07001#!/usr/bin/python
2#
3# Copyright 2010 Google Inc. All Rights Reserved.
4"""
5This allows a site to customize the test creation attributes.
6
7"""
8
9
10import common, re
Kenneth Watersbdaab792011-01-07 13:18:10 -080011from autotest_lib.frontend.afe import models
Mike Truty2b2cafc2010-04-05 14:30:15 -070012
13
14def _set_attributes_custom(test, data):
15 # We set the test name to the dirname of the control file.
16 test_new_name = test.path.split('/')
17 if test_new_name[-1] == 'control' or test_new_name[-1] == 'control.srv':
18 test.name = test_new_name[-2]
19 else:
20 control_name = "%s:%s"
21 control_name %= (test_new_name[-2],
22 test_new_name[-1])
23 test.name = re.sub('control.*\.', '', control_name)
24
25 # We set verify to always False (0).
26 test.run_verify = 0
Kenneth Watersbdaab792011-01-07 13:18:10 -080027
28 if hasattr(data, 'test_parameters'):
29 for para_name in data.test_parameters:
30 test_parameter = models.TestParameter.objects.get_or_create(
31 test=test, name=para_name)[0]
32 test_parameter.save()