5 # Create startup script in ramdisk
6 my $S99 = "$FindBin::Bin/initramfs/etc/init.d/S99benchmark";
8 system("cat > $S99; chmod +x $S99") unless -t STDIN;
17 last if ($ready = m/Welcome to Buildroot/ ||
19 m/t...a...s...k...s... ...s...t...a...r...t...e...d/); # RTEMS has bug - it sends 4 characters instead of just one
21 die "Boot failed" unless $ready;
26 echo "Starting latester"
27 sudo ip l set eth0 down
28 sudo ~/bin/latester -d can0 -d can1 -d can2 -c 3200 -q --oneattime -n tmp
33 for i in sent lost enobufs $(seq -f percentile%g 0 10 100); do keyval="$keyval $i=$((i))"; done
34 echo "! PERF: gw_latency $avg µs $keyval ok"
35 test $avg -eq 0 && exit 1
39 my $status = system((qw(ssh -T glab), $latester));
44 sub kill_boot() { kill('TERM', -$pid) if defined $pid; }
47 # die("No boot command") if ($#ARGV eq -1);
48 my $bootcmd = scalar @ARGV ? "'".join("' '", @ARGV)."'" : "$FindBin::Bin/boot";
50 $SIG{INT} = sub { kill_boot(); exit; };
51 $SIG{HUP} = sub { kill_boot(); exit; };
52 $SIG{ALRM} = sub { kill_boot(); exit; };
53 $SIG{TERM} = sub { kill_boot(); exit; };
54 $SIG{QUIT} = sub { kill_boot(); exit; };
56 pipe($boot, $wh) || die("pipe: $!");
57 my $pid = fork() // die("fork: $!");
59 setpgrp(); # Start new process group so that we can kill all
60 # background processes at once
62 open(STDERR, ">&", $wh) || die "Can't dup STDERR: $!";
63 my $cmd = "$bootcmd 2>&1 | tee /dev/stderr";
64 exec($cmd) || die "Can't exec $cmd: $!";