forked from jprjr/setup-openresty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest
executable file
·80 lines (71 loc) · 1.65 KB
/
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env perl
use strict;
use warnings;
use Cwd;
my $dir = getcwd();
my $distros = {
'debian' => [
'7',
'8',
'9',
],
'ubuntu' => [
'12.04',
'14.04',
'16.04',
],
'centos' => [
'7',
],
'fedora' => [
'25',
'26',
],
'alpine' => [
'3.5',
'3.6',
],
'opensuse' => [
'42.3',
],
'base/archlinux' => [
'latest',
],
};
sub run {
my @args = @_;
print(join(' ',@args)."\n");
system(@args);
if($? & 127) {
print(join(' ',@args)."\n");
printf("Termsig: %d\n",$? & 127);
exit(1);
}
else {
my $exitcode = $? >> 8;
if($exitcode != 0) {
print(join(' ',@args)."\n");
printf("Exitcode: %d\n",$exitcode);
exit(1);
}
}
}
my @distros_to_test;
if(defined($ARGV[0])) {
if($ARGV[0] =~ m/:/) {
run('docker', 'pull', $ARGV[0]);
run('docker', 'run', '--rm', '-ti', '-v', "${dir}:/tmp/setup-openresty", $ARGV[0], "/bin/sh", "-c", "/tmp/setup-openresty/setup-openresty --large --symlink && openresty -V && luarocks-openresty install luacrypto");
exit(0);
}
push(@distros_to_test,$ARGV[0]);
}
else {
@distros_to_test = keys %$distros;
}
foreach my $distro (@distros_to_test) {
foreach my $version (@{$distros->{$distro}}) {
print "Testing ${distro}:${version}\n";
run('docker', 'pull', "${distro}:${version}");
run('docker', 'run', '--rm', '-ti', '-v', "${dir}:/tmp/setup-openresty", "${distro}:${version}", "/bin/sh", "-c", "/tmp/setup-openresty/setup-openresty --large --symlink && openresty -V && luarocks-openresty install luacrypto");
}
}