forked from PoC-Consortium/engraver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.pl
executable file
·69 lines (50 loc) · 1.74 KB
/
test.pl
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env perl
# For Emacs: -*- mode:cperl -*-
use strict;
use warnings;
use Carp;
use Getopt::Long; # command line options processing
my $plotbin = './plot64';
my $md5sum = ($^O eq "darwin") ? 'md5 -q' : 'md5sum';
my $expected = '4f81804ea010744877163a87f56fc225';
my $keep = 0;
GetOptions(
'keep' => \$keep, # keep generated test files
) or croak "Formal error processing command line options!";
if (! -x $plotbin) {
print "$plotbin binary not present. Compile it first.\n";
exit 1;
}
# Test Core 0 (scalar)
print qx{$plotbin -a -v -k 11424087411148401423 -d core0 -x 0 -s 0 -n 128 -t 4};
cmp_digest('core0/11424087411148401423_0_128', $expected);
# Test Core 1 (SSE4)
print qx{$plotbin -a -v -k 11424087411148401423 -d core1 -x 1 -s 0 -n 128 -t 4};
cmp_digest('core1/11424087411148401423_0_128', $expected);
# Test Core 2 (AVX2) if not on TRAVIS
if (defined $ENV{TRAVIS} && $ENV{TRAVIS} =~ m{true}xmsi) {
print "Skipping AVX2 test as TRAVIS does not support it.\n"
}
else {
print qx{$plotbin -a -v -k 11424087411148401423 -d core2 -x 2 -s 0 -n 128 -t 4};
cmp_digest('core2/11424087411148401423_0_128', $expected);
}
# Test Core 0 with Direct IO
print qx{$plotbin -D -a -v -k 11424087411148401423 -d core0_dio -x 0 -s 0 -n 128 -t 4};
cmp_digest('core0_dio/11424087411148401423_0_128_128', $expected);
# cleanup
qx{rm -rf core0 core1 core2 core0_dio} if (!$keep);
sub cmp_digest {
my $file = shift;
my $expect = shift;
my $digest = `$md5sum $file`;
chomp $digest;
if ($digest =~ m{^\Q$expected}) {
print "Digest OK\n"
}
else {
print "Digest did not match. Expected $expected got $digest\n";
exit 1;
}
return;
}