scc

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

test.sh (490B)


      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 
     30 $EXEC scc dump |
     31 sed -n '/^data:/,$ {
     32 	/^data:/ ! {
     33 		s%.*:%%
     34 		s%^[ 	]*%%
     35 		s%[ 	]*$%%
     36 		/^$/d
     37 		s%[ 	][ 	]*%\
     38 %g
     39 		p
     40 	}
     41 }' |
     42 nl -b a > $tmp2
     43 
     44 diff -u $tmp1 $tmp2