Debian Codegraph @

tests/run_tests

raw ◀ ▶
1 Debian patch touch this file
1 #!/usr/bin/env perl
2 ##
3 ## Copyright (c) 2012, 2015 The University of Utah
4 ## All rights reserved.
5 ##
6 ## This file is distributed under the University of Illinois Open Source
7 ## License. See the file COPYING for details.
8
9 ###############################################################################
10
11 use strict;
12 use warnings;
13
14 use File::Temp qw/ tempfile tempdir /;
15 use Cwd;
16
17 my @tests = (
18 { "name" => "test0",
19 "unreduced" => "file1.c",
20 "test_script" => "test0.sh",
21 },
22 { "name" => "test1",
23 "unreduced" => "file2.c",
24 "test_script" => "test1.sh",
25 },
26 { "name" => "test2",
27 "unreduced" => "file1.c",
28 "test_script" => "test2.sh",
29 },
30 { "name" => "test3",
31 "unreduced" => "file2.c",
32 "test_script" => "test3.sh",
33 },
34 { "name" => "test4",
35 "unreduced" => "file2.c",
36 "test_script" => "test4.sh",
37 },
38 { "name" => "test5",
39 "unreduced" => "file2.c",
40 "test_script" => "test5.sh",
41 },
42 { "name" => "test6",
43 "unreduced" => "file3.c",
44 "test_script" => "test6.sh",
45 },
46 { "name" => "test7",
47 "unreduced" => "file3.c",
48 "test_script" => "test7.sh",
49 },
50 );
51
52 sub run_test ($) {
53 (my $num) = @_;
54
55 my $tref = $tests[$num];
56 my %test = %{$tref};
57
58 my $name = $test{"name"};
59 my $unreduced = $test{"unreduced"};
60 my $test_script = $test{"test_script"};
61 die unless (defined ($name) &&
62 defined ($unreduced) &&
63 defined ($test_script));
64
65 my $test_dir = getcwd();
66 my $temp_dir = tempdir( "tmp_${name}_XXXXX",
67 DIR => $test_dir,
68 CLEANUP => 0 );
69
70 print "\n\n===== running test $num in $temp_dir =====\n\n\n";
71
72 chdir $temp_dir or die;
73
74 system "cp ../$unreduced .";
75 system "../../creduce/creduce --die-on-pass-bug ../${test_script} $unreduced";
76
77 chdir $test_dir or die;
78 }
79
80 if (scalar(@ARGV)>0) {
81 foreach my $i (@ARGV) {
82 run_test ($i);
83 }
84 } else {
85 for (my $i=0; $i<scalar(@tests); $i++) {
•86 if ($i != 5) {
87 run_test ($i);
88 }
89 }
90 }