@@ -126,25 +126,32 @@ def terminate(self):
126126with pathlib .Path (__file__ ).with_name ('rr-testing.sh' ).open ('rb' ) as f :
127127 rr_testing_script = f .read ()
128128
129+ def config_script_function (config_key ):
130+ lines = []
131+ entry = distro_config .get (config_key )
132+ if isinstance (entry , str ):
133+ lines = [entry ]
134+ elif isinstance (entry , list ):
135+ lines = entry
136+ elif entry is not None :
137+ raise ValueError ('Invalid config entry %s: %s' % (config_key , entry ))
138+ return ('function %s {\n %s\n }' % (config_key , '\n ' .join (lines )))
139+
129140vm = Ec2Vm (args .machine_type , args .architecture , distro_config , args .keypair_pem_file )
130141success = False
131142try :
132143 vm .wait_for_ssh ()
133144 exclude_tests = distro_config ['exclude_tests' ] if 'exclude_tests' in distro_config else []
134- full_script = b'\n ' .join (
135- [b"set -x # echo commands" ,
136- b"set -e # default to exiting on error" ] +
137- list (map (lambda c : c .encode ('utf-8' ), distro_config ['setup_commands' ])) +
145+ full_script = '\n ' .join (
138146 [
139- distro_config ['install_build_deps' ].encode ('utf-8' ),
140- b'%s &' % (distro_config ['install_test_deps' ].encode ('utf-8' )),
141- b'function wait_for_test_deps {\n wait %1\n }' ,
142- b'git_revision=%s' % args .git_revision .encode ('utf-8' ),
143- b'build_dist=%d' % (1 if args .dist_files_dir is not None else 0 ),
144- b'TEST_FIREFOX=%d' % (1 if args .architecture == 'x86_64' else 0 ),
145- b'ctest_options="%s"' % b' ' .join (map (lambda r : b'-E %s' % r .encode ('utf-8' ), exclude_tests )),
146- rr_testing_script
147- ])
147+ config_script_function ('setup_commands' ),
148+ config_script_function ('install_build_deps' ),
149+ config_script_function ('install_test_deps' ),
150+ 'git_revision=%s' % args .git_revision ,
151+ 'build_dist=%d' % (1 if args .dist_files_dir is not None else 0 ),
152+ 'test_firefox=%d' % (1 if args .architecture == 'x86_64' else 0 ),
153+ 'ctest_options="%s"' % ' ' .join ('-E %s' % r for r in exclude_tests ),
154+ ]).encode ('utf-8' ) + b'\n ' + rr_testing_script
148155 vm .ssh (['/bin/bash' , '-s' ], full_script )
149156 if args .dist_files_dir is not None :
150157 vm .scp_from (['-r' ], '/tmp/dist' , args .dist_files_dir )
0 commit comments