scc

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

test.sh (436B)


      1 #!/bin/sh
      2 
      3 set -e
      4 cpu=${1?}
      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" 0 2 3
     13 
     14 as-$cpu $file
     15 
     16 sed -n '/^\#/ ! {
     17 	/\#/ ! d
     18 	s%.*#%%
     19 	s%^[ 	]*%%
     20 	s%[ 	]*$%%
     21 	/^$/d
     22 	s%[ 	][ 	]*%\
     23 %g
     24 	p
     25 }' $file |
     26 nl -b a > $tmp1
     27 
     28 
     29 scc-objdump |
     30 sed -n '/^data:/,$ {
     31 	/^data:/ ! {
     32 		s%.*:%%
     33 		s%^[ 	]*%%
     34 		s%[ 	]*$%%
     35 		/^$/d
     36 		s%[ 	][ 	]*%\
     37 %g
     38 		p
     39 	}
     40 }' |
     41 nl -b a > $tmp2
     42 
     43 echo diff
     44 diff -u $tmp1 $tmp2