summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoruwe <uwe@openbsd.org>2017-08-14 20:14:56 +0000
committeruwe <uwe@openbsd.org>2017-08-14 20:14:56 +0000
commitcd676757fff64768e212b9e00fff720f33b85a04 (patch)
treeefe26247831aeb7e64a798b2573f5bd09bd19c1e
parentsimplify LABEL extraction; from tb@ (diff)
downloadwireguard-openbsd-cd676757fff64768e212b9e00fff720f33b85a04.tar.xz
wireguard-openbsd-cd676757fff64768e212b9e00fff720f33b85a04.zip
Add a very basic test for ctfdump(1) on amd64
If the output of ctfdump(1) is correct, it would imply that ctfconv(1) and ctfstrip(1) also worked as expected, at least to some extent. :) ok mpi, bluhm
-rw-r--r--regress/usr.bin/ctfdump/Makefile33
-rw-r--r--regress/usr.bin/ctfdump/base_types_encoding.amd647
-rw-r--r--regress/usr.bin/ctfdump/example.c13
3 files changed, 53 insertions, 0 deletions
diff --git a/regress/usr.bin/ctfdump/Makefile b/regress/usr.bin/ctfdump/Makefile
new file mode 100644
index 00000000000..780d57397f6
--- /dev/null
+++ b/regress/usr.bin/ctfdump/Makefile
@@ -0,0 +1,33 @@
+# $OpenBSD: Makefile,v 1.1 2017/08/14 20:14:56 uwe Exp $
+
+# If you are unsure whether the output of ctfdump(1) is correct, you can
+# install ctftools from ports and set CTFDUMP=/usr/local/bin/ctfdump.
+CTFDUMP?= /usr/bin/ctfdump
+CTFSTRIP?= /usr/bin/ctfstrip
+
+PROG= example
+DEBUG+= -g
+
+REGRESS_TARGETS= base_types_encoding
+
+# Test the proper encoding and display of base types in the C language.
+base_types_encoding: ${PROG}.ctf
+ ${MAKE} -C ${.CURDIR} run-${PROG} RT=$@ RE=' (INTEGER|FLOAT) '
+
+# Run ctfdump(1) and massage the output to make it stable. ${RT} is the
+# original test target; ${RE} reducces the output to the relevant lines.
+run-${PROG}: ${PROG}.ctf
+ ${CTFDUMP} ${PROG}.ctf 2>&1 | sed 's/\[[0-9]*\]/[]/' | sort | egrep '${RE}' >${RT}.out
+.if exists(${RT}.${MACHINE})
+ diff -u ${.CURDIR}/${RT}.${MACHINE} ${RT}.out
+ @echo ok - ${RT}
+.else
+ @echo SKIPPED - ${RT}.${MACHINE} not found
+.endif
+
+${PROG}.ctf: ${PROG}
+ ${CTFSTRIP} -o ${PROG}.ctf ${PROG}
+
+CLEANFILES+= ${PROG}.ctf *.out
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.bin/ctfdump/base_types_encoding.amd64 b/regress/usr.bin/ctfdump/base_types_encoding.amd64
new file mode 100644
index 00000000000..ebbbe943b25
--- /dev/null
+++ b/regress/usr.bin/ctfdump/base_types_encoding.amd64
@@ -0,0 +1,7 @@
+ [] FLOAT float encoding=0x1 offset=0 bits=32
+ [] FLOAT float encoding=0x2 offset=0 bits=64
+ [] FLOAT float encoding=0x6 offset=0 bits=128
+ [] INTEGER char encoding=SIGNED CHAR offset=0 bits=8
+ [] INTEGER signed encoding=SIGNED offset=0 bits=32
+ [] INTEGER signed encoding=SIGNED offset=0 bits=64
+ [] INTEGER void encoding=SIGNED offset=0 bits=0
diff --git a/regress/usr.bin/ctfdump/example.c b/regress/usr.bin/ctfdump/example.c
new file mode 100644
index 00000000000..2b864d1f795
--- /dev/null
+++ b/regress/usr.bin/ctfdump/example.c
@@ -0,0 +1,13 @@
+/* base types */
+int i;
+long l;
+long long ll;
+float f;
+double d;
+long double ld;
+
+int
+main(int argc, char *argv[])
+{
+ return 0;
+}