scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

test.sh (471B)


      1 #!/bin/sh
      2 
      3 set -e
      4 cpu=${1?'missed cpu argument'}
      5 exec >>test.log
      6 exec 2>&1
      7 
      8 tmp1=tmp1.$$
      9 tmp2=tmp2.$$
     10 file=$cpu.s
     11 
     12 trap 'rm -f a.out $tmp1 $tmp2' EXIT
     13 trap 'exit $?' HUP INT TERM
     14 
     15 $EXEC scc as -m $cpu $file
     16 
     17 sed -n '/^\#/ ! {
     18 	/\#/ ! d
     19 	s%.*#%%
     20 	s%^[ 	]*%%
     21 	s%[ 	]*$%%
     22 	/^$/d
     23 	s%[ 	][ 	]*%\
     24 %g
     25 	p
     26 }' $file |
     27 nl -b a > $tmp1
     28 
     29 od -An -t x1 a.out |
     30 tr 'a-z' 'A-Z' |
     31 sed -n 's%.*:%%
     32 	s%^[ 	]*%%
     33 	s%[ 	]*$%%
     34 	/^$/d
     35 	s%[ 	][ 	]*%\
     36 %g
     37 	p' |
     38 nl -b a > $tmp2
     39 
     40 diff -u $tmp1 $tmp2