Skip to content

Commit

Permalink
update so PLA can submit smolder reports. Add a new prove tool, run_t…
Browse files Browse the repository at this point in the history
…est.nqp, which copies some code from t/harness. Eventually I'll move out shared logic into a shared library
  • Loading branch information
Whiteknight committed Sep 16, 2010
1 parent 5894091 commit 8e06466
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
4 changes: 4 additions & 0 deletions setup.nqp
Expand Up @@ -62,6 +62,10 @@ sub setup_test_manifest(%PLA) {
%PLA{'prove_files'} :=
"t/*.t t/pmc/*.t t/methods/nummatrix2d/*.t t/methods/pmcmatrix2d/*.t " ~
"t/methods/complexmatrix2d/*.t t/pir-subclass/*.t";
%PLA{'prove_exec'} := 'parrot-nqp t/run_test.nqp';
%PLA{'smolder_url'} :=
'http://smolder.parrot.org/app/projects/process_add_report/2';
%PLA{'smolder_credentials'} := 'parrot-autobot:qa_rocks';
}

# final step, coerce the list of dynpmc ldflags into a string
Expand Down
62 changes: 62 additions & 0 deletions t/run_test.nqp
@@ -0,0 +1,62 @@
#! parrot-nqp
INIT {
pir::load_bytecode('library/kakapo_full.pbc');
pir::load_bytecode('t/testlib/pla_test.pbc');
}

my $interp := pir::getinterp__P();
my @argv := $interp[2];
MAIN(@argv);

sub MAIN(@argv) {
my $test := @argv.shift;
if $test ne 't/sanity.t' {
my $pla := pir::loadlib__ps("./dynext/linalg_group");
}
compile_and_execute($test);
}

sub is_pir_test($filename) {
my $idx := pir::index__ISS($filename, 't/pir');
if $idx == 0 {
return 1;
}
return 0;
}

sub compile_pir_test($filename) {
my $sub;
Q:PIR {
$P1 = find_lex "$filename"
$P0 = new ['FileHandle']
$P0.'open'($P1)
$P2 = $P0.'readall'()
$P0.'close'()
$P3 = compreg 'PIR'
$P4 = $P3($P2)
$P4 = $P4[0]
store_lex '$sub', $P4
};
return $sub;
}
sub compile_nqp_test($filename) {
my $sub := Nqp::compile_file($filename);
return $sub[0];
}

sub compile_and_execute($filename) {
my $sub;
my $pirfile := is_pir_test($filename);
if $pirfile == 0 {
$sub := compile_nqp_test($filename);
} else {
$sub := compile_pir_test($filename);
}
try {
$sub();
CATCH {
# WAT DO?
}
}
}

0 comments on commit 8e06466

Please sign in to comment.