print elapsed time after successful run

This commit is contained in:
Johannes 'josch' Schauer 2020-08-25 16:06:05 +02:00
parent 07fa6f29c8
commit 7c752fa8a0
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1
2 changed files with 14 additions and 3 deletions

View file

@ -2356,9 +2356,11 @@ cat << END > shared/test.sh
#!/bin/sh
set -eu
export LC_ALL=C.UTF-8
$CMD --mode=root --variant=apt --logfile=log $DEFAULT_DIST /tmp/debian-chroot $mirror
# we check the full log to also prevent debug printfs to accidentally make it into a commit
cat << LOG | diff -u - log
$CMD --mode=root --variant=apt --logfile=log $DEFAULT_DIST /tmp/debian-chroot $mirror
# omit the last line which should contain the runtime
head --lines=-1 log > trimmed
cat << LOG | diff -u - trimmed
I: chroot architecture $HOSTARCH is equal to the host's architecture
I: automatically chosen format: directory
I: running apt-get update...
@ -2367,9 +2369,10 @@ I: extracting archives...
I: installing packages...
I: cleaning package lists and apt cache...
LOG
tail --lines=1 log | grep '^I: success in .* seconds$'
tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
rm -r /tmp/debian-chroot
rm log
rm log trimmed
END
if [ "$HAVE_QEMU" = "yes" ]; then
./run_qemu.sh

View file

@ -41,6 +41,7 @@ use POSIX qw(SIGINT SIGHUP SIGPIPE SIGTERM SIG_BLOCK SIG_UNBLOCK strftime);
use Carp;
use Term::ANSIColor;
use Socket;
use Time::HiRes;
use version;
## no critic (InputOutput::RequireBriefOpen)
@ -3699,6 +3700,8 @@ sub approx_disk_usage {
}
sub main() {
my $before = Time::HiRes::time;
umask 022;
if (scalar @ARGV >= 7 && $ARGV[0] eq "--hook-helper") {
@ -5249,6 +5252,11 @@ sub main() {
$exitstatus = 1;
}
if ($exitstatus == 0) {
my $duration = Time::HiRes::time - $before;
info "success in " . (sprintf "%.04f", $duration) . " seconds";
}
exit $exitstatus;
}