print elapsed time after successful run

pull/1/head
parent 07fa6f29c8
commit 7c752fa8a0
Signed by: josch
GPG Key ID: F2CBA5C78FBD83E1

@ -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

@ -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;
}

Loading…
Cancel
Save