annotate smoketest.sh @ 742:46c4978c9a5c

Add a 60 second timeout to smoketest. (Some qemu failure modes involve hanging.)
author Rob Landley <rob@landley.net>
date Sun, 31 May 2009 02:36:22 -0500
parents 0ac06d08cfe5
children d0157468f73d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
345
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
1 #!/bin/bash
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
2
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
3 # This script compiles stuff under the final system, using distcc to call out
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
4 # to the cross compiler.
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
5
742
46c4978c9a5c Add a 60 second timeout to smoketest. (Some qemu failure modes involve hanging.)
Rob Landley <rob@landley.net>
parents: 732
diff changeset
6 # Set up a timeout. If it doesn't complete in 60 seconds, it failed.
46c4978c9a5c Add a 60 second timeout to smoketest. (Some qemu failure modes involve hanging.)
Rob Landley <rob@landley.net>
parents: 732
diff changeset
7
46c4978c9a5c Add a 60 second timeout to smoketest. (Some qemu failure modes involve hanging.)
Rob Landley <rob@landley.net>
parents: 732
diff changeset
8 timeout()
46c4978c9a5c Add a 60 second timeout to smoketest. (Some qemu failure modes involve hanging.)
Rob Landley <rob@landley.net>
parents: 732
diff changeset
9 {
46c4978c9a5c Add a 60 second timeout to smoketest. (Some qemu failure modes involve hanging.)
Rob Landley <rob@landley.net>
parents: 732
diff changeset
10 sleep 60
46c4978c9a5c Add a 60 second timeout to smoketest. (Some qemu failure modes involve hanging.)
Rob Landley <rob@landley.net>
parents: 732
diff changeset
11 kill $1
46c4978c9a5c Add a 60 second timeout to smoketest. (Some qemu failure modes involve hanging.)
Rob Landley <rob@landley.net>
parents: 732
diff changeset
12 }
46c4978c9a5c Add a 60 second timeout to smoketest. (Some qemu failure modes involve hanging.)
Rob Landley <rob@landley.net>
parents: 732
diff changeset
13
46c4978c9a5c Add a 60 second timeout to smoketest. (Some qemu failure modes involve hanging.)
Rob Landley <rob@landley.net>
parents: 732
diff changeset
14 timeout $$ &
46c4978c9a5c Add a 60 second timeout to smoketest. (Some qemu failure modes involve hanging.)
Rob Landley <rob@landley.net>
parents: 732
diff changeset
15 trap "kill $(jobs -p) 2>/dev/null" EXIT
46c4978c9a5c Add a 60 second timeout to smoketest. (Some qemu failure modes involve hanging.)
Rob Landley <rob@landley.net>
parents: 732
diff changeset
16
46c4978c9a5c Add a 60 second timeout to smoketest. (Some qemu failure modes involve hanging.)
Rob Landley <rob@landley.net>
parents: 732
diff changeset
17 # Call run-from-build with a here document to do stuff.
46c4978c9a5c Add a 60 second timeout to smoketest. (Some qemu failure modes involve hanging.)
Rob Landley <rob@landley.net>
parents: 732
diff changeset
18
345
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
19 # Note that the first line of the script is a few spaces followed by a comment
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
20 # character. This gives some harmless data for the linux boot process to
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
21 # consume and discard before it gets to the command prompt. I don't know why
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
22 # it does this, but it does. The comment character is so you can see how
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
23 # much got eaten, generally about 3 characters.
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
24
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
25 # If you cat your own script into emulator-build.sh, you probably also need
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
26 # to start with a line of spaces like that. Just FYI.
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
27
522
148b62e763d3 Update to new paths.
Rob Landley <rob@landley.net>
parents: 345
diff changeset
28 ./run-from-build.sh $1 << 'EOF'
345
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
29 #
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
30 # Show free space
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
31 df
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
32 # Smoke test for the compiler
732
0ac06d08cfe5 Root directory isn't writable with squashfs, use /tmp instead.
Rob Landley <rob@landley.net>
parents: 522
diff changeset
33 gcc -s /usr/src/thread-hello2.c -lpthread -o /tmp/hello &&
0ac06d08cfe5 Root directory isn't writable with squashfs, use /tmp instead.
Rob Landley <rob@landley.net>
parents: 522
diff changeset
34 /tmp/hello
345
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
35 sync
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
36 exit
1a70dfe0a436 Quick smoke test for system image: ./smoketest.sh $ARCH | grep 'Hello world!'
Rob Landley <rob@landley.net>
parents:
diff changeset
37 EOF