Mercurial > hg > aboriginal
annotate forkbomb.sh @ 299:dc5f5eeea57d
Fix display glitch with --nofork.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 16 Feb 2008 23:19:13 -0600 |
parents | b2e353ae7566 |
children | 352b71189c93 |
rev | line source |
---|---|
206
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/bash |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 # Test script to build every target architecture, logging output. |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 # With --fork, it builds them in parallel |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 # With --nofork, it build them sequentially |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 # With --watch, it displays output from an existing parallel build |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 function buildarch() |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 { |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 nice -n 20 ./cross-compiler.sh $1 && |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 nice -n 20 ./mini-native.sh $1 && |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 nice -n 20 ./package-mini-native.sh $1 |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 } |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 if [ "$1" != "--watch" ] |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
16 then |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
17 if [ $# -ne 0 ] |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 then |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
212
diff
changeset
|
19 (nice -n 20 ./download.sh && |
262
b2e353ae7566
Have host-tools populate build/host with 1) toybox, 2) all the remaining
Rob Landley <rob@landley.net>
parents:
258
diff
changeset
|
20 # host-tools populates one directory with every command the build needs, |
b2e353ae7566
Have host-tools populate build/host with 1) toybox, 2) all the remaining
Rob Landley <rob@landley.net>
parents:
258
diff
changeset
|
21 # so we can ditch the old $PATH afterwards. |
253
f93932523a08
Reorder forkbomb build so ./host-tools.sh gets built first. Then toybox
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
22 nice -n 20 ./host-tools.sh && |
262
b2e353ae7566
Have host-tools populate build/host with 1) toybox, 2) all the remaining
Rob Landley <rob@landley.net>
parents:
258
diff
changeset
|
23 PATH=`pwd`/build/host && |
253
f93932523a08
Reorder forkbomb build so ./host-tools.sh gets built first. Then toybox
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
24 nice -n 20 ./download.sh --extract ) || exit 1 |
206
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
25 fi |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
26 for i in `cd sources/configs; ls` |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
27 do |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
28 if [ "$1" == "--nofork" ] |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 then |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 buildarch $i 2>&1 | tee out-$i.txt || exit 1 |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
31 elif [ "$1" == "--fork" ] |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
32 then |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
33 (buildarch $i > out-$i.txt 2>&1 &)& |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
34 else |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
35 echo "Usage: forkbomb.sh [--fork] [--nofork] [--watch]" |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
36 exit 1 |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
37 fi |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 done |
b328036dbdb1
Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 fi |
299
dc5f5eeea57d
Fix display glitch with --nofork.
Rob Landley <rob@landley.net>
parents:
262
diff
changeset
|
40 |
dc5f5eeea57d
Fix display glitch with --nofork.
Rob Landley <rob@landley.net>
parents:
262
diff
changeset
|
41 if [ "$1" != "--nofork" ] |
dc5f5eeea57d
Fix display glitch with --nofork.
Rob Landley <rob@landley.net>
parents:
262
diff
changeset
|
42 then |
dc5f5eeea57d
Fix display glitch with --nofork.
Rob Landley <rob@landley.net>
parents:
262
diff
changeset
|
43 watch -n 3 'X=; for i in out-*.txt; do /bin/echo -e "$X$i"; X="\n"; tail -n 1 $i; done' |
dc5f5eeea57d
Fix display glitch with --nofork.
Rob Landley <rob@landley.net>
parents:
262
diff
changeset
|
44 fi |