scc

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

commit 2064ec660622faf77cfc404d32f0370a673ad00b
parent d6699d5f6615b95083b3b20250921a5c1dcfb719
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 12 Mar 2018 20:57:10 +0100

[tests/nm] Factorize the creation of the a.out file

We can move it to the Makefile and avoid repeating the same in every
shell script.

Diffstat:
Mtests/nm/execute/0001-z80.sh | 5++---
Mtests/nm/execute/0002-z80-u.sh | 5++---
Mtests/nm/execute/0003-z80-g.sh | 5++---
Mtests/nm/execute/0004-z80-v.sh | 5++---
Mtests/nm/execute/0005-z80-A.sh | 85+++++++++++++++++++++++++++++++++++++++----------------------------------------
Mtests/nm/execute/Makefile | 7++++++-
6 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/tests/nm/execute/0001-z80.sh b/tests/nm/execute/0001-z80.sh @@ -4,10 +4,9 @@ set -e tmp1=`mktemp` tmp2=`mktemp` -trap "rm -f a.out $tmp1 $tmp2" 0 2 3 +trap "rm -f $tmp1 $tmp2" 0 2 3 -z80-unknown-coff-as master.s -nm > $tmp1 +nm z80.out > $tmp1 cat <<! > $tmp2 0000000000000000 b .bss diff --git a/tests/nm/execute/0002-z80-u.sh b/tests/nm/execute/0002-z80-u.sh @@ -4,10 +4,9 @@ set -e tmp1=`mktemp` tmp2=`mktemp` -trap "rm -f a.out $tmp1 $tmp2" 0 2 3 +trap "rm -f $tmp1 $tmp2" 0 2 3 -z80-unknown-coff-as master.s -nm -u > $tmp1 +nm -u z80.out > $tmp1 cat <<! > $tmp2 U text6 diff --git a/tests/nm/execute/0003-z80-g.sh b/tests/nm/execute/0003-z80-g.sh @@ -4,10 +4,9 @@ set -e tmp1=`mktemp` tmp2=`mktemp` -trap "rm -f a.out $tmp1 $tmp2" 0 2 3 +trap "rm -f $tmp1 $tmp2" 0 2 3 -z80-unknown-coff-as master.s -nm -g > $tmp1 +nm -g z80.out > $tmp1 cat <<! > $tmp2 0000000000000001 B averylongbss diff --git a/tests/nm/execute/0004-z80-v.sh b/tests/nm/execute/0004-z80-v.sh @@ -4,10 +4,9 @@ set -e tmp1=`mktemp` tmp2=`mktemp` -trap "rm -f a.out $tmp1 $tmp2" 0 2 3 +trap "rm -f $tmp1 $tmp2" 0 2 3 -z80-unknown-coff-as master.s -nm -v > $tmp1 +nm -v z80.out > $tmp1 cat <<! > $tmp2 U text6 diff --git a/tests/nm/execute/0005-z80-A.sh b/tests/nm/execute/0005-z80-A.sh @@ -4,35 +4,34 @@ set -e tmp1=`mktemp` tmp2=`mktemp` -trap "rm -f a.out f.out f.a $tmp1 $tmp2" 0 2 3 +trap "rm -f f.out f.a $tmp1 $tmp2" 0 2 3 rm -f f.a -z80-unknown-coff-as master.s -ar -qv f.a a.out -cp a.out f.out +ar -qv f.a z80.out +cp z80.out f.out ar -qv f.a f.out -nm -A f.a a.out > $tmp1 +nm -A f.a z80.out > $tmp1 cat <<! > $tmp2 -f.a[a.out]: 0000000000000000 b .bss -f.a[a.out]: 0000000000000000 d .data -f.a[a.out]: 0000000000000000 t .text -f.a[a.out]: 0000000000000001 B averylongbss -f.a[a.out]: 0000000000000001 D averylongdata -f.a[a.out]: 0000000000000001 T averylongtext -f.a[a.out]: 0000000000000000 B bss1 -f.a[a.out]: 0000000000000002 b bss3 -f.a[a.out]: 000000000000000a C bss4 -f.a[a.out]: 0000000000000012 C bss5 -f.a[a.out]: 0000000000000000 D data1 -f.a[a.out]: 0000000000000002 d data3 -f.a[a.out]: 000000000000000a C data4 -f.a[a.out]: 0000000000000012 C data5 -f.a[a.out]: 0000000000000000 T text1 -f.a[a.out]: 0000000000000002 t text3 -f.a[a.out]: 000000000000000a C text4 -f.a[a.out]: 0000000000000012 C text5 -f.a[a.out]: U text6 +f.a[z80.out]: 0000000000000000 b .bss +f.a[z80.out]: 0000000000000000 d .data +f.a[z80.out]: 0000000000000000 t .text +f.a[z80.out]: 0000000000000001 B averylongbss +f.a[z80.out]: 0000000000000001 D averylongdata +f.a[z80.out]: 0000000000000001 T averylongtext +f.a[z80.out]: 0000000000000000 B bss1 +f.a[z80.out]: 0000000000000002 b bss3 +f.a[z80.out]: 000000000000000a C bss4 +f.a[z80.out]: 0000000000000012 C bss5 +f.a[z80.out]: 0000000000000000 D data1 +f.a[z80.out]: 0000000000000002 d data3 +f.a[z80.out]: 000000000000000a C data4 +f.a[z80.out]: 0000000000000012 C data5 +f.a[z80.out]: 0000000000000000 T text1 +f.a[z80.out]: 0000000000000002 t text3 +f.a[z80.out]: 000000000000000a C text4 +f.a[z80.out]: 0000000000000012 C text5 +f.a[z80.out]: U text6 f.a[f.out]: 0000000000000000 b .bss f.a[f.out]: 0000000000000000 d .data f.a[f.out]: 0000000000000000 t .text @@ -52,25 +51,25 @@ f.a[f.out]: 0000000000000002 t text3 f.a[f.out]: 000000000000000a C text4 f.a[f.out]: 0000000000000012 C text5 f.a[f.out]: U text6 -a.out: 0000000000000000 b .bss -a.out: 0000000000000000 d .data -a.out: 0000000000000000 t .text -a.out: 0000000000000001 B averylongbss -a.out: 0000000000000001 D averylongdata -a.out: 0000000000000001 T averylongtext -a.out: 0000000000000000 B bss1 -a.out: 0000000000000002 b bss3 -a.out: 000000000000000a C bss4 -a.out: 0000000000000012 C bss5 -a.out: 0000000000000000 D data1 -a.out: 0000000000000002 d data3 -a.out: 000000000000000a C data4 -a.out: 0000000000000012 C data5 -a.out: 0000000000000000 T text1 -a.out: 0000000000000002 t text3 -a.out: 000000000000000a C text4 -a.out: 0000000000000012 C text5 -a.out: U text6 +z80.out: 0000000000000000 b .bss +z80.out: 0000000000000000 d .data +z80.out: 0000000000000000 t .text +z80.out: 0000000000000001 B averylongbss +z80.out: 0000000000000001 D averylongdata +z80.out: 0000000000000001 T averylongtext +z80.out: 0000000000000000 B bss1 +z80.out: 0000000000000002 b bss3 +z80.out: 000000000000000a C bss4 +z80.out: 0000000000000012 C bss5 +z80.out: 0000000000000000 D data1 +z80.out: 0000000000000002 d data3 +z80.out: 000000000000000a C data4 +z80.out: 0000000000000012 C data5 +z80.out: 0000000000000000 T text1 +z80.out: 0000000000000002 t text3 +z80.out: 000000000000000a C text4 +z80.out: 0000000000000012 C text5 +z80.out: U text6 ! diff $tmp1 $tmp2 diff --git a/tests/nm/execute/Makefile b/tests/nm/execute/Makefile @@ -3,10 +3,15 @@ PROJECTDIR=$$PWD/../../.. ROOTDIR=$(PROJECTDIR)/rootdir +OUT = z80.out + all: tests -tests: master.s +tests: $(OUT) @PATH=$(ROOTDIR)/bin:$$PATH ./chktest.sh +z80.out: master.s + z80-unknown-coff-as -o $@ master.s + clean: rm -f *.a *.out test.log