scc

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

commit 29366934e10a3b77952788494396b6097873f8e9
parent caa96d4e8c805e2ae1634f4f49d6291d5507287e
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 27 Aug 2019 20:54:43 +0100

[tests/strip] Add basic test for strip

Diffstat:
Atests/strip/execute/0001-z80.sh | 18++++++++++++++++++
Atests/strip/execute/Makefile | 15+++++++++++++++
Atests/strip/execute/chktest.sh | 12++++++++++++
Atests/strip/execute/master.s | 31+++++++++++++++++++++++++++++++
4 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/tests/strip/execute/0001-z80.sh b/tests/strip/execute/0001-z80.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +set -e +trap 'rm -f $tmp1 $tmp2 $tmp3' EXIT HUP INT QUIT TERM + +tmp1=tmpfile1 +tmp2=tmpfile2 +tmp3=tmpfile3 + +cp z80.out $tmp1 +strip $tmp1 > $tmp2 +z80-unknown-coff-nm $tmp1 >> $tmp2 2>&1 || true + +cat > $tmp3 <<EOF +z80-unknown-coff-nm: $tmp1: no symbols +EOF + +diff $tmp2 $tmp3 diff --git a/tests/strip/execute/Makefile b/tests/strip/execute/Makefile @@ -0,0 +1,15 @@ +.POSIX: +ROOT=../../.. + +OUT = z80.out + +all: tests + +tests: $(OUT) + @PATH=$(ROOT)/bin:$$PATH:. chktest.sh + +z80.out: master.s + z80-unknown-coff-as -o $@ master.s + +clean: + rm -f *.a *.out test.log diff --git a/tests/strip/execute/chktest.sh b/tests/strip/execute/chktest.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +trap "rm -f a.out; exit" 0 2 3 15 +ulimit -c 0 +rm -f test.log + +for i in *-*.sh +do + printf "Test: %s\n\n" $i >> test.log + ./$i >> test.log 2>&1 && printf '[PASS]\t' || printf '[FAIL]\t' + echo "$i" +done diff --git a/tests/strip/execute/master.s b/tests/strip/execute/master.s @@ -0,0 +1,31 @@ + .globl text1,averylongtext,text5 + .extern text6 + .text + .equ text2,4 +text1: .byte 0 +averylongtext: + .byte 0 +text3: .byte 0 + .comm text4,10 + .comm text5,18 + .short text6 + + .globl data1,averylongdata,data5 + .data + .equ data2,5 +data1: .byte 3 +averylongdata: + .byte 0 +data3: .byte 0 + .comm data4,10 + .comm data5,18 + + .globl bss1,averylongbss,bss5 + .bss + .equ bss2,5 +bss1: .byte 0 +averylongbss: + .byte 0 +bss3: .byte 0 + .comm bss4,10 + .comm bss5,18