aboutsummaryrefslogtreecommitdiff
path: root/test/cxxfilt
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2016-05-19 20:06:56 +0000
committerEd Maste <emaste@FreeBSD.org>2016-05-19 20:06:56 +0000
commita7f03fcfe7109df232200b8b5e1f715a18ba7d74 (patch)
tree5d850df4522f52e077ecb35866e624861ceeb1f6 /test/cxxfilt
parent7c9f2b63d3a1c147cf1bd709b562d6273908d5b6 (diff)
Notes
Diffstat (limited to 'test/cxxfilt')
-rw-r--r--test/cxxfilt/Makefile6
-rw-r--r--test/cxxfilt/tet_scen11
-rw-r--r--test/cxxfilt/tetexec.cfg5
-rw-r--r--test/cxxfilt/ts/Makefile7
-rwxr-xr-xtest/cxxfilt/ts/common/func.sh49
-rwxr-xr-xtest/cxxfilt/ts/common/gen.awk33
-rw-r--r--test/cxxfilt/ts/common/ts.mk15
-rw-r--r--test/cxxfilt/ts/misc/Makefile5
-rw-r--r--test/cxxfilt/ts/misc/tclist15
9 files changed, 146 insertions, 0 deletions
diff --git a/test/cxxfilt/Makefile b/test/cxxfilt/Makefile
new file mode 100644
index 000000000000..adc67069bf63
--- /dev/null
+++ b/test/cxxfilt/Makefile
@@ -0,0 +1,6 @@
+# $Id$
+
+TOP= ../..
+SUBDIR= ts
+
+.include "${TOP}/mk/elftoolchain.tetbase.mk"
diff --git a/test/cxxfilt/tet_scen b/test/cxxfilt/tet_scen
new file mode 100644
index 000000000000..2f920e30ae4a
--- /dev/null
+++ b/test/cxxfilt/tet_scen
@@ -0,0 +1,11 @@
+# $Id$
+
+all
+ "Starting Test Suite"
+ ^misc
+ "Complete Test Suite"
+
+misc
+ "Starting noarg Test"
+ /ts/misc/tc
+ "Complete noarg Test"
diff --git a/test/cxxfilt/tetexec.cfg b/test/cxxfilt/tetexec.cfg
new file mode 100644
index 000000000000..580b3aea6c50
--- /dev/null
+++ b/test/cxxfilt/tetexec.cfg
@@ -0,0 +1,5 @@
+# elfdump Test Suite.
+#
+# $Id$
+
+TET_OUTPUT_CAPTURE=False
diff --git a/test/cxxfilt/ts/Makefile b/test/cxxfilt/ts/Makefile
new file mode 100644
index 000000000000..0dff69204380
--- /dev/null
+++ b/test/cxxfilt/ts/Makefile
@@ -0,0 +1,7 @@
+# $Id$
+
+TOP= ../../..
+
+SUBDIR+= misc
+
+.include "${TOP}/mk/elftoolchain.subdir.mk" \ No newline at end of file
diff --git a/test/cxxfilt/ts/common/func.sh b/test/cxxfilt/ts/common/func.sh
new file mode 100755
index 000000000000..b3956eb72066
--- /dev/null
+++ b/test/cxxfilt/ts/common/func.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# $Id$
+
+tpstart() # write test purpose banner and initialise variables
+{
+ tet_infoline "$*"
+ FAIL=N
+}
+
+tpresult() # give test purpose result
+{
+ # $1 is result code to give if FAIL=N (default PASS)
+ if [ $FAIL = N ]; then
+ tet_result ${1-PASS}
+ else
+ tet_result FAIL
+ fi
+}
+
+check_rlt() # execute command (saving output) and check exit code
+{
+ # $1 is command, $2 is expected exit code (0 or "N" for non-zero)
+ RLT=`$1`
+ CODE=$?
+ if [ $2 = 0 -a $CODE -ne 0 ]; then
+ tet_infoline "Command ($1) gave exit code $CODE, expected 0"
+ FAIL=Y
+ elif [ $2 != 0 -a $CODE -eq 0 ]; then
+ tet_infoline "Command ($1) gave exit code $CODE, expected non-zero"
+ FAIL=Y
+ fi
+
+ # $3 is expected result.
+ if [ "$RLT" != "$3" ]; then
+ tet_infoline "Command ($1) gave wrong result:"
+ tet_infoline "$RLT"
+ tet_infoline "expected:"
+ tet_infoline "$3"
+ FAIL=Y
+ fi
+}
+
+run()
+{
+ tpstart "Running test '$1'"
+ check_rlt "$TET_SUITE_ROOT/../../cxxfilt/c++filt $1" 0 "$2"
+ tpresult
+}
diff --git a/test/cxxfilt/ts/common/gen.awk b/test/cxxfilt/ts/common/gen.awk
new file mode 100755
index 000000000000..9aa8973659b7
--- /dev/null
+++ b/test/cxxfilt/ts/common/gen.awk
@@ -0,0 +1,33 @@
+#!/usr/bin/awk -f
+#
+# $Id$
+
+BEGIN {
+ FS = "\""
+ tp = 0
+ print "#!/bin/sh\n"
+}
+
+{
+ sub(/#.*/, "");
+ if (NF >= 5) {
+ tp++
+ printf("tp%d()\n{\n run \"%s\" \"%s\"\n}\n\n", tp, $2, $4);
+ }
+}
+
+END {
+ print "tet_startup=\"\""
+ print "tet_cleanup=\"\"\n"
+ printf("%s", "iclist=\"");
+ for (i = 1; i <= tp; i++) {
+ printf("ic%d", i);
+ if (i != tp)
+ printf(" ");
+ }
+ printf("\"\n\n");
+ for (i = 1; i <= tp; i++)
+ printf("ic%d=\"tp%d\"\n", i, i);
+ print "\n. $TET_SUITE_ROOT/ts/common/func.sh";
+ print ". $TET_ROOT/lib/xpg3sh/tcm.sh";
+}
diff --git a/test/cxxfilt/ts/common/ts.mk b/test/cxxfilt/ts/common/ts.mk
new file mode 100644
index 000000000000..12429b2a943a
--- /dev/null
+++ b/test/cxxfilt/ts/common/ts.mk
@@ -0,0 +1,15 @@
+# $Id$
+
+TCLIST?= tclist
+
+.PHONY: all
+
+all: tc
+
+tc: ${TCLIST}
+ ${.CURDIR}/../common/gen.awk ${.ALLSRC} > ${.TARGET}
+ chmod +x ${.TARGET}
+
+clean:
+ rm -rf tc
+
diff --git a/test/cxxfilt/ts/misc/Makefile b/test/cxxfilt/ts/misc/Makefile
new file mode 100644
index 000000000000..ecc228b09b30
--- /dev/null
+++ b/test/cxxfilt/ts/misc/Makefile
@@ -0,0 +1,5 @@
+# $Id$
+
+TOP= ../../../..
+
+.include "../common/ts.mk"
diff --git a/test/cxxfilt/ts/misc/tclist b/test/cxxfilt/ts/misc/tclist
new file mode 100644
index 000000000000..afc1cf62fcbb
--- /dev/null
+++ b/test/cxxfilt/ts/misc/tclist
@@ -0,0 +1,15 @@
+# simple function
+
+"_Z1f", "f"
+"_Z1fi", "f(int)"
+"_Z1fic", "f(int, char)"
+
+# namespace
+
+"_ZN12elftoolchainE", "elftoolchain"
+"_ZN11elftoolchainE", "_ZN11elftoolchainE"
+"_ZN12elftoolchain", "_ZN12elftoolchain"
+"_ZN12elftoolchain3foo3barE", "elftoolchain::foo::bar"
+"_ZN12elftoolchain3foo3barEi", "elftoolchain::foo::bar(int)"
+"_ZN12elftoolchain3foo3barEic", "elftoolchain::foo::bar(int, char)"
+