annotate tools/ecsx @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
rev   line source
0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
1 #!/bin/bash
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
2
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
3 # Usage: ecsx b.s pas0.c
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
4
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
5 HOST=ecs.ox.ac.uk
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
6 ARMGCC='arm-linux-gnueabihf-gcc -marm -march=armv6'
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
7 QEMU=qemu-arm
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
8
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
9 # Make sure socket directory exists
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
10 mkdir -p ~/.ssh/sockets
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
11
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
12 # Remote temp directory for this test
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
13 dir="ecsx-$$"
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
14
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
15 # Form a batch job
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
16 ( echo /bin/mkdir -p $dir
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
17 # Create source files
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
18 for f in $*; do
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
19 echo "/bin/cat >$dir/$f <<\\EOF"
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
20 cat $f
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
21 echo EOF
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
22 done
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
23 # Compile and run
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
24 echo "(cd $dir; set -x;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
25 $ARMGCC $* -static -o b.out && $QEMU ./b.out)"
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
26 # Delete the directory
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
27 echo /bin/rm -rf $dir ) \
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
28 |
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
29 # Submit it to the server, reusing a previous connection if possible
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
30 ssh -o 'ControlMaster auto' -o 'ControlPath ~/.ssh/sockets/%r@%h-%p' \
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
31 -o 'ControlPersist 600' $HOST /bin/bash
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
32