#NEWLINE# def generate_qitest_json( self ) : #NEWLINE# #INDENT# ' The qitest.cmake is written from CMake ' #NEWLINE# qitest_cmake_path = os . path . join ( self . build_directory , 'qitest.cmake' ) #NEWLINE# tests = list ( ) #NEWLINE# if os . path . exists ( qitest_cmake_path ) : #NEWLINE# #INDENT# with open ( qitest_cmake_path , 'r' ) as fp : #NEWLINE# #INDENT# lines = fp . readlines ( ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# lines = list ( ) #NEWLINE# #UNINDENT# parser = argparse . ArgumentParser ( ) #NEWLINE# parser . add_argument ( 'cmd' , nargs = '+' ) #NEWLINE# parser . add_argument ( '--name' , required = True ) #NEWLINE# parser . add_argument ( '--gtest' , action = 'store_true' , help = 'Tell qitest this is a test using gtest' ) #NEWLINE# parser . add_argument ( '--timeout' , type = int ) #NEWLINE# parser . add_argument ( '--nightly' , action = 'store_true' ) #NEWLINE# parser . add_argument ( '--perf' , action = 'store_true' ) #NEWLINE# parser . add_argument ( '--working-directory' ) #NEWLINE# parser . add_argument ( '--env' , action = 'append' , dest = 'environment' ) #NEWLINE# parser . set_defaults ( nightly = False , perf = False ) #NEWLINE# def log_error( message , line ) : #NEWLINE# #INDENT# test_name = line . split ( ';' ) [ 1 ] #NEWLINE# mess = ( "Could not parse test options for test: '%s'\n" % test_name ) #NEWLINE# mess += ( 'Error was: %s' % message ) #NEWLINE# ui . error ( mess ) #NEWLINE# #UNINDENT# for line in lines : #NEWLINE# #INDENT# parser . error = ( lambda message : log_error ( message , line ) ) #NEWLINE# line = line . strip ( ) #NEWLINE# try : #NEWLINE# #INDENT# args = parser . parse_args ( args = line . split ( ';' ) ) #NEWLINE# #UNINDENT# except SystemExit : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# test = vars ( args ) #NEWLINE# as_list = test [ 'environment' ] #NEWLINE# if as_list : #NEWLINE# #INDENT# test [ 'environment' ] = dict ( ( x . split ( '=' ) for x in as_list ) ) #NEWLINE# #UNINDENT# tests . append ( test ) #NEWLINE# #UNINDENT# with open ( self . qitest_json , 'w' ) as fp : #NEWLINE# #INDENT# json . dump ( tests , fp , indent = 2 )