-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-and-test
executable file
·49 lines (34 loc) · 1.32 KB
/
update-and-test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env raku
=begin overview
Not everyone runs the extended test suite; this gives developers the ability
to test as they go; it updates the repository, runs xtest only on those
files that have changed in that update, and leaves a local C<retest> script
that can be rerun against those changes until xtest is clean.
Note that test files are allowed to skip certain tests if they are run on a restricted
subset of files; the full C<make xtest> should still be run on a regular basis.
=end overview
# Get the old and new commit IDs
sub get-rev {
run(<git rev-parse HEAD>, :out).out.slurp(:close).chomp;
}
my $old-rev = get-rev;
run(<git pull --rebase>);
my $new-rev = get-rev;
if $old-rev eq $new-rev {
say "No changes to test.";
} else {
say "Updating prerequisites";
run(<zef install --deps-only .>);
my $revs = $old-rev ~ ".." ~ $new-rev;
my $files = run('git', 'diff', '--name-only', $revs, :out).out.slurp(:close).chomp.split("\n").sort.join(" ");
my $outfile = "./retest";
my $of = $outfile.IO.open(:w);
$of.say: "#!/usr/bin/env raku";
$of.say: "\%*ENV<TEST_FILES>='$files';";
$of.say: "say \%*ENV<TEST_FILES>;";
$of.say: "run(<make xtest>).so";
$of.close;
run('chmod', 'a+x', $outfile);
run($outfile).so;
say "Test same set of files again with $outfile";
}