1# Copyright (c) 2014 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5"""Templates for results a test can emit. 6""" 7 8# TODO(beeps): The right way to create these status logs is by creating a job 9# object and invoking job.record on it. However we perform this template 10# hack instead for the following reasons: 11# * The templates are a lot easier to understand at first glance, which 12# is really what one wants from a testing interface built for a 13# framework like autotest. 14# * Creating the job is wedged into core autotest code, so it has 15# unintended consequences like checking for hosts/labels etc. 16# * We are guaranteed to create the bare minimum by hand specifying the file 17# to write, and their contents. Job.record ends up checking and creating 18# several non-essential directoris in the process or recording status. 19 20success_test_template = ( 21 "\tSTART\t%(test_name)s\t%(test_name)s" 22 "\ttimestamp=%(timestamp)s\tlocaltime=%(date)s\n" 23 "\t\tGOOD\t%(test_name)s\t%(test_name)s\ttimestamp=%(timestamp)s\t" 24 "localtime=%(date)s\tcompleted successfully\n" 25 "\tEND GOOD\t%(test_name)s\t%(test_name)s\ttimestamp=%(timestamp)s\t" 26 "localtime=%(date)s") 27 28 29success_job_template = ( 30 "START\t----\t----\ttimestamp=%(timestamp)s\tlocaltime=%(date)s" 31 "\n\tSTART\t%(test_name)s\t%(test_name)s\ttimestamp=%(timestamp)s\t" 32 "localtime=%(date)s\n\t\tGOOD\t%(test_name)s\t%(test_name)s" 33 "\ttimestamp=%(timestamp)s\tlocaltime=%(date)s\tcompleted " 34 "successfully\n\tEND GOOD\t%(test_name)s\t%(test_name)s" 35 "\ttimestamp=%(timestamp)s\tlocaltime=%(date)s\n" 36 "END GOOD\t----\t----\ttimestamp=%(timestamp)s\tlocaltime=%(date)s") 37 38 39job_keyvals_template = "hostname=%(hostname)s\nstatus_version=1\n" 40 41