ref: 279bf67dfc38f55a3c9f4529799686608bd28bb4
parent: 1623dbdd55d0ee760c4a1c17c5881f7ca0153186
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Aug 27 16:54:43 EDT 2019
[tests/strip] Add basic test for strip
--- /dev/null
+++ b/tests/strip/execute/0001-z80.sh
@@ -1,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
--- /dev/null
+++ b/tests/strip/execute/Makefile
@@ -1,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
--- /dev/null
+++ b/tests/strip/execute/chktest.sh
@@ -1,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
--- /dev/null
+++ b/tests/strip/execute/master.s
@@ -1,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