2 # Copyright (C) 2010, Parrot Foundation.
15 opts = _parse_opts(argv)
16 $I0 = exists opts['help']
21 .tailcall do(opts, argv)
26 parrot t/harness.pir [options] [testfiles]
30 --archive ... create a TAP archive of the test run
31 --send-to-smolder ... send the TAP archive to the Parrot Smolder server
35 .sub '_parse_opts' :anon
37 load_bytecode 'Getopt/Obj.pbc'
38 $P0 = new ['Getopt';'Obj']
41 push $P0, 'core-tests'
42 push $P0, 'runcore-tests'
43 push $P0, 'code-tests'
46 push $P0, 'send-to-smolder'
48 $P1 = $P0.'get_options'(argv)
55 set_test_prog_args(opts)
56 load_bytecode 'TAP/Harness.pbc'
57 .local pmc options, env, harness, aggregate
60 $I0 = exists env['HARNESS_VERBOSE']
62 $S0 = env['HARNESS_VERBOSE']
63 options['verbosity'] = $S0
65 $I0 = exists opts['archive']
67 harness = new ['TAP';'Harness']
68 options['directives'] = 1
71 harness = new ['TAP';'Harness';'Archive']
72 harness.'archive'('parrot_test_run.tar.gz')
75 env_data = collect_test_environment_data()
76 harness.'extra_props'(env_data)
77 $P0 = split ' ', 'myconfig config_lib.pir'
78 harness.'extra_files'($P0)
80 harness.'process_args'(options)
81 $P0 = _get_tests(opts, files)
82 aggregate = harness.'runtests'($P0)
83 $I0 = exists opts['send-to-smolder']
85 .tailcall send_archive_to_smolder(env_data)
87 $I0 = aggregate.'all_passed'()
92 .sub 'set_test_prog_args' :anon
95 $I0 = exists opts['gc-debug']
99 $I0 = exists opts['run-exec']
105 $P0['TEST_PROG_ARGS'] = $S0
108 .sub '_get_tests' :anon
112 $I0 = opts['code-tests']
114 .const string developing_tests = 't/distro/file_metadata.t t/codingstd/*.t'
115 files = glob(developing_tests)
119 unless nb == 0 goto L2
120 files = _get_common_tests(opts)
123 # currently, FixedStringArray hasn't the method sort.
125 $P0 = new 'FixedPMCArray'
132 $P2 = split "\\", $S0
143 .sub '_get_common_tests' :anon
145 .const string runcore_tests = <<'TEST'
146 t/compilers/imcc/*/*.t
154 .const string core_tests = <<'TEST'
159 .const string library_tests = <<'TEST'
162 t/compilers/pge/p5regex/*.t
163 t/compilers/pge/perl6regex/*.t
169 .const string configure_tests = <<'TEST'
175 $I0 = exists opts['runcore-tests']
178 $I0 = exists opts['core-tests']
181 $S0 .= configure_tests
183 $P0 = split "\n", $S0
189 .include 'iglobals.pasm'
191 .sub 'collect_test_environment_data' :anon
192 .local pmc config, env
194 config = $P0[.IGLOBALS_CONFIG_HASH]
198 arch = config['cpuarch']
199 $P0['Architecture'] = arch
200 $S0 = _get_compiler_version(config)
201 $P0['Compiler'] = $S0
203 devel = config['DEVEL']
205 .local string optimize
207 $I0 = exists config['optimize']
209 optimize = config['optimize']
211 $P0['Optimize'] = optimize
213 osname = config['osname']
214 $P0['Platform'] = osname
215 .local string version
216 version = config['VERSION']
217 $P0['Version'] = version
218 .local string submitter
219 submitter = _get_submitter(config, env)
220 $P0['Submitter'] = submitter
221 _add_subversion_info($P0)
225 .sub '_get_compiler_version' :anon
228 $I0 = index $S0, 'gcc'
229 unless $I0 >= 0 goto L1
230 $I0 = exists config['gccversion']
233 $S1 = config['gccversion']
237 $I0 = index $S0, 'cl'
238 unless $I0 >= 0 goto L2
239 $I0 = exists config['msvcversion']
242 $S1 = config['msvcversion']
246 $I0 = exists config['gccversion']
249 $S1 = config['gccversion']
254 $I0 = exists config['msvcversion']
257 $S1 = config['msvcversion']
265 .sub '_get_submitter' :anon
268 $I0 = exists env['SMOLDER_SUBMITTER']
270 $S0 = env['SMOLDER_SUBMITTER']
274 $I0 = exists config['win32']
281 $S0 = me . '@unknown'
285 .include 'cclass.pasm'
287 .sub '_add_subversion_info' :anon
289 $I0 = file_exists('.svn')
291 $P0 = new 'FileHandle'
292 $P0.'open'('svn info', 'pr')
293 $S0 = $P0.'readall'()
297 $I1 = index $S0, '/branches/'
298 unless $I1 >= 0 goto L2
300 $I2 = find_not_cclass .CCLASS_WHITESPACE, $S0, $I1, $I0
302 $S1 = substr $S0, $I1, $I3
305 $P0.'open'('svn status', 'pr')
306 $P1 = new 'ResizableStringArray'
311 unless $I0 == 0 goto L3
314 $I0 = find_not_cclass .CCLASS_WHITESPACE, $S0, 2, $I0
315 $S0 = substr $S0, $I0
321 unless $I0 != 0 goto L1
329 hash['Modifications'] = $S0
334 .sub 'send_archive_to_smolder' :anon
336 load_bytecode 'osutils.pbc'
337 .const string archive = 'parrot_test_run.tar.gz'
338 .const string smolder_url = 'http://smolder.plusthree.com/app/projects/process_add_report/8'
339 .const string username = 'parrot-autobot'
340 .const string password = 'squ@wk'
343 config = $P0[.IGLOBALS_CONFIG_HASH]
345 cmd = "curl -F architecture="
346 $S0 = config['cpuarch']
348 cmd .= " -F platform="
349 $S0 = config['osname']
351 cmd .= " -F revision="
352 $S0 = config['revision']
355 $S0 = _get_tags(env_data)
358 cmd .= " -F username="
360 cmd .= " -F password="
362 cmd .= " -F comments=\"EXPERIMENTAL t/harness.pir\""
363 cmd .= " -F report_file=@"
367 .tailcall system(cmd, 1 :named('verbose'))
370 .sub '_get_tags' :anon
372 $P0 = split ' ', 'Architecture Compiler Platform Version'
373 $P1 = new 'ResizableStringArray'
390 # vim: expandtab shiftwidth=4 ft=pir: