From 94bc95b1bd180865178e1b0b2147216f12dca32a Mon Sep 17 00:00:00 2001 From: Nicolas Joly <njoly@pasteur.fr> Date: Wed, 27 May 2015 08:39:40 -0700 Subject: [PATCH] Adjust time/date/cp commands in tests for portability These changes are required to support NetBSD. 1) Use standard -p option for time command in test17.35 instead of GNU specific format string to fetch the elapsed (real) time. 2) Adjust date command calls in test22.1 to use short option (--date -> -d), and move options before arguments. NetBSD, unlike Linux, disallow non standard order. 3) Use standard -R option instead of -r for cp command in test30.1. --- testsuite/expect/test17.35 | 29 +++++++++++++---------------- testsuite/expect/test22.1 | 6 +++--- testsuite/expect/test30.1 | 2 +- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/testsuite/expect/test17.35 b/testsuite/expect/test17.35 index 0317d8d770a..426ae3b3553 100755 --- a/testsuite/expect/test17.35 +++ b/testsuite/expect/test17.35 @@ -56,31 +56,28 @@ wait set match 0 set time_used 100000 set timeout [expr $max_job_delay * 10] -spawn time -f "elapsed %E" ./$file_in +spawn time -p ./$file_in expect { -re "Submitted batch job ($number)" { incr match exp_continue } - -re "elapsed ($number):($digit)($digit).($digit)($digit)" { - set mins $expect_out(1,string) - set secs [expr $expect_out(2,string) * 10 + $expect_out(3,string)] - set tenths $expect_out(4,string) - set hundredths $expect_out(5,string) - set time_used [expr $mins * 60000 + $secs * 1000 + $tenths * 100 + $hundredths * 10] + -re "real *($number).($digit)($digit)" { + set secs $expect_out(1,string) + set tenths $expect_out(2,string) + set hundredths $expect_out(3,string) + set time_used [expr $secs * 1000 + $tenths * 100 + $hundredths * 10] exp_continue } - -re "elapsed ($number):($digit)($digit).($digit)" { - set mins $expect_out(1,string) - set secs [expr $expect_out(2,string) * 10 + $expect_out(3,string)] - set tenths $expect_out(4,string) - set time_used [expr $mins * 60000 + $secs * 1000 + $tenths * 100] + -re "real *($number).($digit)" { + set secs $expect_out(1,string) + set tenths $expect_out(2,string) + set time_used [expr $secs * 1000 + $tenths * 100] exp_continue } - -re "elapsed ($number):($digit)($digit)" { - set mins $expect_out(1,string) - set secs [expr $expect_out(2,string) * 10 + $expect_out(3,string)] - set time_used [expr $mins * 60000 + $secs * 1000] + -re "real *($number)" { + set secs $expect_out(1,string) + set time_used [expr $secs * 1000] exp_continue } timeout { diff --git a/testsuite/expect/test22.1 b/testsuite/expect/test22.1 index 3af74d1ba1a..f67b5306384 100755 --- a/testsuite/expect/test22.1 +++ b/testsuite/expect/test22.1 @@ -89,15 +89,15 @@ print_header $test_id # Fri Thu Jan 31 00:00:00 2008 - Needed only for the 00:00:00 for timing purposes set midnight_time "Thu Jan 31 00:00:00 2008" -set midnight [exec date +%s --date=$midnight_time] +set midnight [exec date -d $midnight_time +%s] # Mon Dec 31 23:00:00 2007 set start_date "Mon Dec 31 23:00:00 2007" -set period_start [exec date +%s --date=$start_date] +set period_start [exec date -d $start_date +%s] # Thu Jan 31 23:59:59 2008 set end_date "Thu Jan 31 23:59:59 2008" -set period_end [exec date +%s --date=$end_date] +set period_end [exec date -d $end_date +%s] set start_str [timestamp -format %Y-%m-%dT%X -seconds $period_start] set end_str [timestamp -format %Y-%m-%dT%X -seconds $period_end] diff --git a/testsuite/expect/test30.1 b/testsuite/expect/test30.1 index 3c19c7f821b..e6616e420c4 100755 --- a/testsuite/expect/test30.1 +++ b/testsuite/expect/test30.1 @@ -78,7 +78,7 @@ if {[test_cray] || [test_alps]} { set timeout 1000 exec $bin_rm -fr /tmp/slurm $tar_name /tmp/built_rpms -spawn $bin_cp -L -r -v $src_dir /tmp/slurm +spawn $bin_cp -L -R -v $src_dir /tmp/slurm expect { timeout { send_user "\nFAILURE: $src_dir was not copied\n" -- GitLab