Skip to content

Commit

Permalink
Allow tests to be run outside of rakudo dir
Browse files Browse the repository at this point in the history
Absolutify lib paths and file paths using $?FILE.IO.parent(...),
since a test can know the file layout of its own repo but not the
cwd the user is invoking a test from.

This allows you to install perl6, clone the roast anywhere you
wish, and then run the spectest with:
prove -v -e 'perl6' path/to/roast/*.t

fudging still needs to be done:
perl fudgeall rakudo.moar **/*.t > test-list-spaces.txt
perl -p -e 's/\s+/\n/g' test-list-spaces.txt > test-list.txt
prove --ignore-exit -r -j4 -e 'perl6' - < test-list.txt

This doesn't handle the spectest.data list since it does not exist
in this repo. The important step here is simply getting out of
the rakudo repo, which makes parallel build system stuff possible.
  • Loading branch information
ugexe committed Feb 23, 2018
1 parent 4f6cd0c commit dfe7430
Show file tree
Hide file tree
Showing 265 changed files with 483 additions and 475 deletions.
2 changes: 1 addition & 1 deletion MISC/bug-coverage-6.d.t
@@ -1,5 +1,5 @@
use v6.d.PREVIEW;
use lib <t/spec/packages>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down
5 changes: 3 additions & 2 deletions MISC/bug-coverage-stress.t
@@ -1,5 +1,5 @@
use v6.c;
use lib <t/spec/packages>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down Expand Up @@ -138,8 +138,9 @@ given make-temp-dir() {

# https://github.com/rakudo/rakudo/issues/1413
#?rakudo.jvm todo 'IllegalArgumentException: bad parameter count 850; https://github.com/rakudo/rakudo/issues/1413'
my $package-lib-prefix = $?FILE.IO.parent(2).IO.add('packages').absolute;
is_run use RAKUDO1413; print 'pass',
:compiler-args[<-Ipackages -It/spec/packages>],
:compiler-args['-I', $package-lib-prefix],
{:out<pass>, :err(''), :0status},
'no crashes with giant enums in packages';

Expand Down
2 changes: 1 addition & 1 deletion MISC/bug-coverage.t
@@ -1,5 +1,5 @@
use v6.c;
use lib <t/spec/packages>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down
2 changes: 1 addition & 1 deletion S01-perl-5-integration/eval_lex.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages/>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;
plan 2;
Expand Down
2 changes: 1 addition & 1 deletion S02-lists/indexing.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages/>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;
plan 4;
Expand Down
2 changes: 1 addition & 1 deletion S02-literals/allomorphic.t
@@ -1,7 +1,7 @@
# S02-literals/allomorphic.t --- Tests for the various allmorphic types, and val() processing

use v6;
use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down
2 changes: 1 addition & 1 deletion S02-literals/heredocs.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages/>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;
plan 34;
Expand Down
2 changes: 1 addition & 1 deletion S02-literals/pairs.t
@@ -1,6 +1,6 @@
use v6;

use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");

use Test;
use Test::Idempotence;
Expand Down
3 changes: 1 addition & 2 deletions S02-literals/quoting.t
@@ -1,6 +1,5 @@
use v6;
use lib <t/spec/packages>;
use lib <packages>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;
plan 212;
Expand Down
2 changes: 1 addition & 1 deletion S02-literals/string-interpolation.t
@@ -1,5 +1,5 @@
use v6;
use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");

use Test;
use Test::Util;
Expand Down
4 changes: 2 additions & 2 deletions S02-magicals/78258.t
@@ -1,5 +1,5 @@
use v6;

use lib 't/spec/S02-magicals';
use UsedEnv; # contains plan
use lib $?FILE.IO.parent;

use UsedEnv; # contains plan
2 changes: 1 addition & 1 deletion S02-magicals/KERNEL.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down
2 changes: 1 addition & 1 deletion S02-magicals/args.t
@@ -1,5 +1,5 @@
use v6;
use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");

use Test;

Expand Down
2 changes: 1 addition & 1 deletion S02-magicals/env.t
@@ -1,7 +1,7 @@
use v6;

# Tests for magic variables
use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");

use Test;
use Test::Util;
Expand Down
2 changes: 1 addition & 1 deletion S02-magicals/pid.t
@@ -1,5 +1,5 @@
use v6;
use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");

use Test;
use Test::Util;
Expand Down
6 changes: 3 additions & 3 deletions S02-magicals/progname.t
@@ -1,13 +1,13 @@
use v6;
use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");

use Test;
use Test::Util;

plan 4;

ok($*PROGRAM ~~ / t['/'|'\\']spec['/'|'\\']S02'-'magicals['/'|'\\']progname'.'\w+$/, "progname var matches test file path");
ok(PROCESS::<$PROGRAM> ~~ / t['/'|'\\']spec['/'|'\\']S02'-'magicals['/'|'\\']progname'.'\w+$/, "progname var accessible as context var");
ok($*PROGRAM ~~ /S02'-'magicals['/'|'\\']progname'.'\w+$/, "progname var matches test file path");
ok(PROCESS::<$PROGRAM> ~~ /S02'-'magicals['/'|'\\']progname'.'\w+$/, "progname var accessible as context var");

# NOTE:
# above is a junction hack for Unix and Win32 file
Expand Down
2 changes: 1 addition & 1 deletion S02-one-pass-parsing/misc.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down
2 changes: 1 addition & 1 deletion S02-types/bag-iterator.t
@@ -1,7 +1,7 @@
use v6;
use Test;

use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");
use Test::Iterator;

plan 2 * 7;
Expand Down
2 changes: 1 addition & 1 deletion S02-types/capture.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;
plan 43;
Expand Down
2 changes: 1 addition & 1 deletion S02-types/declare.t
Expand Up @@ -390,7 +390,7 @@ plan 70;
# L<S09/Sized types/>
# int in1 int2 int4 int8 int16 in32 int64
# uint uin1 uint2 uint4 uint8 uint16 uint32 uint64
# t/spec/S02-builtin_data_types/int-uint.t already has these covered
# S02-builtin_data_types/int-uint.t already has these covered

# L<S09/Sized types/"num16">
# num16 num32 num64 num128
Expand Down
2 changes: 1 addition & 1 deletion S02-types/list.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages/>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down
2 changes: 1 addition & 1 deletion S02-types/mix-iterator.t
@@ -1,7 +1,7 @@
use v6;
use Test;

use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");
use Test::Iterator;

plan 2 * 7;
Expand Down
2 changes: 1 addition & 1 deletion S02-types/mix.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages>;
use lib $?FILE.IO.parent(2).add("packages");
use Test::Util;
use Test;

Expand Down
2 changes: 1 addition & 1 deletion S02-types/mixhash.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages>;
use lib $?FILE.IO.parent(2).add("packages");
use Test::Util;
use Test;

Expand Down
2 changes: 1 addition & 1 deletion S02-types/mu.t
@@ -1,5 +1,5 @@
use v6;
use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down
2 changes: 1 addition & 1 deletion S02-types/range-iterator.t
@@ -1,7 +1,7 @@
use v6;
use Test;

use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");
use Test::Iterator;

plan 12 * 6;
Expand Down
2 changes: 1 addition & 1 deletion S02-types/set-iterator.t
@@ -1,7 +1,7 @@
use v6;
use Test;

use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");
use Test::Iterator;

plan 2 * 6;
Expand Down
2 changes: 1 addition & 1 deletion S02-types/version.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages/>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down
2 changes: 1 addition & 1 deletion S02-types/whatever.t
@@ -1,6 +1,6 @@
use v6;

use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");

use Test;
use Test::Util;
Expand Down
2 changes: 1 addition & 1 deletion S03-metaops/hyper.t
@@ -1,6 +1,6 @@
use v6;

use lib "t/spec/packages";
use lib $?FILE.IO.parent(2).add("packages");

use Test;
use Test::Util;
Expand Down
4 changes: 2 additions & 2 deletions S03-operators/context-forcers.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages/>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down Expand Up @@ -176,7 +176,7 @@ subtest 'numeric context' => {
}

# int context
# tested in t/spec/S32-num/int.t
# tested in S32-num/int.t

{
my $x = [0, 100, 280, 33, 400, 5665];
Expand Down
4 changes: 2 additions & 2 deletions S03-operators/minmax.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand All @@ -12,7 +12,7 @@ plan 39;

=begin description
This test min/max functions in their operator form. To see them tested in their other forms, see C<t/spec/S32-list/minmax.t>
This test min/max functions in their operator form. To see them tested in their other forms, see C<S32-list/minmax.t>
=end description

Expand Down
2 changes: 1 addition & 1 deletion S03-operators/range.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down
2 changes: 1 addition & 1 deletion S03-operators/repeat.t
@@ -1,6 +1,6 @@
use v6;
use Test;
use lib ('t/spec/packages'.IO.e ?? 't/spec/packages' !! 'packages');
use lib $?FILE.IO.parent(2).add("packages");
use Test::Util;

=begin description
Expand Down
2 changes: 1 addition & 1 deletion S03-operators/short-circuit.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down
4 changes: 2 additions & 2 deletions S03-smartmatch/disorganized.t
Expand Up @@ -25,11 +25,11 @@ sub eval_elsewhere($code){ EVAL($code) }
# Set Hash
# Any Hash

# Regex tests are in spec/S05-*
# Regex tests are in S05-*

#L<S03/"Smart matching"/in range>
{
# more range tests in t/spec/S03-operators/range.t
# more range tests in S03-operators/range.t
is-deeply((5 ~~ 1 .. 10), True, "5 is in 1 .. 10");
is-deeply(!(10 ~~ 1 .. 5), True, "10 is not in 1 .. 5");
is-deeply(!(1 ~~ 5 .. 10), True, "1 is not i n 5 .. 10");
Expand Down
2 changes: 1 addition & 1 deletion S04-declarations/constant.t
@@ -1,7 +1,7 @@
use v6;

use Test;
use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");
plan 72;

# L<S04/The Relationship of Blocks and Declarations/"The new constant declarator">
Expand Down
2 changes: 1 addition & 1 deletion S04-exception-handlers/control.t
@@ -1,6 +1,6 @@
use v6;

use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");

use Test;
use Test::Util;
Expand Down
2 changes: 1 addition & 1 deletion S04-exceptions/exceptions-json.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down
2 changes: 1 addition & 1 deletion S04-exceptions/fail.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down
2 changes: 1 addition & 1 deletion S04-phasers/end.t
@@ -1,6 +1,6 @@
use v6;

use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");

use Test;
use Test::Util;
Expand Down
2 changes: 1 addition & 1 deletion S04-phasers/enter-leave.t
@@ -1,6 +1,6 @@
use v6;

use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");

use Test;
use Test::Util;
Expand Down
4 changes: 2 additions & 2 deletions S04-phasers/in-loop.t
Expand Up @@ -7,8 +7,8 @@ plan 19;
# TODO, based on synopsis 4:
#
# * KEEP, UNDO, PRE, POST, CONTROL
# CATCH is tested in t/spec/S04-statements/try.t
# and t/spec/S04-exception-handlers/catch.t
# CATCH is tested in S04-statements/try.t
# and S04-exception-handlers/catch.t
#
# * $var will undo, etc
#
Expand Down
2 changes: 1 addition & 1 deletion S04-phasers/keep-undo.t
@@ -1,6 +1,6 @@
use v6;

use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");

use Test;
use Test::Util;
Expand Down
2 changes: 1 addition & 1 deletion S04-statements/loop.t
@@ -1,5 +1,5 @@
use v6;
use lib <t/spec/packages/>;
use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

Expand Down
2 changes: 1 addition & 1 deletion S04-statements/quietly.t
@@ -1,6 +1,6 @@
use v6;

use lib 't/spec/packages';
use lib $?FILE.IO.parent(2).add("packages");

use Test;
use Test::Util;
Expand Down

0 comments on commit dfe7430

Please sign in to comment.