55use strict;
66use warnings;
77
8+ use File::Path qw( make_path remove_tree) ;
89use FindBin;
10+
11+ use File::Copy::Recursive qw( dircopy fcopy) ;
12+
913use constant autobuild_root => " $FindBin::Bin /../../../" ;
1014$ENV {' PATH' } = " $ENV {'PATH'}:" . autobuild_root;
1115use lib autobuild_root;
1418use common::utility;
1519use common::test_utils;
1620
17- use File::Path qw( make_path remove_tree) ;
18-
1921my $runs = " runs" ;
2022my $run = " $runs /run" ;
2123my $run1 = " $runs /run1" ;
2224my $run2 = " $runs /run2" ;
2325
2426sub run_cmd {
25- my $cmd = shift ;
26- print " $cmd \n " ;
27- return system ($cmd );
28- }
29-
30- sub copy_to ($;$) {
31- my $des_dir = shift ;
32- my $src_dir = shift // $run ;
33- run_cmd(" cp -R $src_dir $des_dir " );
27+ my $cmd = shift ();
28+ print (" RUN: $cmd \n " );
29+ die () if (!utility::run_command($cmd ));
3430}
3531
3632sub run_scoreboard {
37- run_cmd(" scoreboard.pl -c -f ./test.xml -o test.html -d $run " );
33+ run_cmd(" scoreboard.pl -c -f ./runs /test.xml -o test.html -d $run " );
3834}
3935
4036sub compare_runs {
41- my $r = 0;
42- my $index = " build1/index.html" ;
43- my $total = " build3/2021_03_09_17_33_Totals.html" ;
44- $r += compare_files(" $run1 /$index " , " $run2 /$index " );
45- $r += compare_files(" $run1 /$index " , " $run /$index " );
46- $r += compare_files(" $run1 /$total " , " $run2 /$total " );
47- $r += compare_files(" $run1 /$total " , " $run /$total " );
48- return $r ;
37+ my $r = 0;
38+ my $index = " build1/index.html" ;
39+ my $total = " build3/2021_03_09_17_33_Totals.html" ;
40+ $r += compare_files(" $run1 /$index " , " $run2 /$index " );
41+ $r += compare_files(" $run1 /$index " , " $run /$index " );
42+ $r += compare_files(" $run1 /$total " , " $run2 /$total " );
43+ $r += compare_files(" $run1 /$total " , " $run /$total " );
44+ return $r ;
4945}
5046
5147remove_tree($runs );
@@ -55,21 +51,22 @@ sub compare_runs {
5551}
5652
5753make_path($runs );
58- copy_to($run , " ../build_logs" );
54+ fcopy(" ../build_logs/test.xml" , $runs );
55+ dircopy(" ../build_logs" , $run );
5956
6057run_scoreboard();
61- copy_to($run1 );
6258
59+ dircopy($run , $run1 );
6360run_scoreboard();
64- copy_to($run2 );
6561
62+ dircopy($run , $run2 );
6663run_scoreboard();
67- my $exit_status = compare_runs();
6864
65+ my $exit_status = compare_runs();
6966if ($exit_status ) {
70- print (" Test Failed\n " );
67+ print (" Test Failed\n " );
7168}
7269else {
73- print (" Test Passed\n " );
70+ print (" Test Passed\n " );
7471}
7572exit ($exit_status );
0 commit comments