summaryrefslogtreecommitdiff
path: root/usr/src/common/saveargs/tests/functional
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/common/saveargs/tests/functional')
-rw-r--r--usr/src/common/saveargs/tests/functional/Makefile45
-rw-r--r--usr/src/common/saveargs/tests/functional/align.c32
-rw-r--r--usr/src/common/saveargs/tests/functional/basic.c32
-rw-r--r--usr/src/common/saveargs/tests/functional/big-struct-ret-and-spill.c38
-rw-r--r--usr/src/common/saveargs/tests/functional/big-struct-ret.c38
-rw-r--r--usr/src/common/saveargs/tests/functional/small-struct-ret-and-spill.c37
-rw-r--r--usr/src/common/saveargs/tests/functional/small-struct-ret.c37
-rw-r--r--usr/src/common/saveargs/tests/functional/stack-spill.c32
-rw-r--r--usr/src/common/saveargs/tests/functional/test.sh37
9 files changed, 328 insertions, 0 deletions
diff --git a/usr/src/common/saveargs/tests/functional/Makefile b/usr/src/common/saveargs/tests/functional/Makefile
new file mode 100644
index 0000000000..d8810eb49a
--- /dev/null
+++ b/usr/src/common/saveargs/tests/functional/Makefile
@@ -0,0 +1,45 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2012, Richard Lowe.
+#
+
+include $(SRC)/Makefile.master
+include $(SRC)/Makefile.master.64
+
+.KEEP_STATE:
+
+PROGS = align \
+ basic \
+ big-struct-ret \
+ big-struct-ret-and-spill \
+ small-struct-ret \
+ small-struct-ret-and-spill \
+ stack-spill
+
+CFLAGS += $(CTF_FLAGS)
+CFLAGS64 += $(CTF_FLAGS)
+
+%: %.c
+ $(LINK.c) -o $@ $< -lc
+ $(CTFCONVERT) -L VERSION $@
+
+all: $(PROGS)
+
+install: all
+
+clean:
+ $(RM) $(PROGS)
+
+clobber: clean
+
+FRC:
diff --git a/usr/src/common/saveargs/tests/functional/align.c b/usr/src/common/saveargs/tests/functional/align.c
new file mode 100644
index 0000000000..731ca5eccb
--- /dev/null
+++ b/usr/src/common/saveargs/tests/functional/align.c
@@ -0,0 +1,32 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2012, Richard Lowe.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+int
+test(long a, long b, long c, long d, long e)
+{
+ printf("%ld %ld %ld %ld %ld\n", a, b, c, d, e);
+ for (;;)
+ sleep(60);
+}
+
+int
+main(int argc, char **argv)
+{
+ test(1, 2, 3, 4, 5);
+ return (0);
+}
diff --git a/usr/src/common/saveargs/tests/functional/basic.c b/usr/src/common/saveargs/tests/functional/basic.c
new file mode 100644
index 0000000000..4a6a3819a6
--- /dev/null
+++ b/usr/src/common/saveargs/tests/functional/basic.c
@@ -0,0 +1,32 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2012, Richard Lowe.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+int
+test(long a, long b, long c, long d)
+{
+ printf("%ld %ld %ld %ld\n", a, b, c, d);
+ for (;;)
+ sleep(60);
+}
+
+int
+main(int argc, char **argv)
+{
+ test(1, 2, 3, 4);
+ return (0);
+}
diff --git a/usr/src/common/saveargs/tests/functional/big-struct-ret-and-spill.c b/usr/src/common/saveargs/tests/functional/big-struct-ret-and-spill.c
new file mode 100644
index 0000000000..4823346299
--- /dev/null
+++ b/usr/src/common/saveargs/tests/functional/big-struct-ret-and-spill.c
@@ -0,0 +1,38 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2012, Richard Lowe.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+struct foo {
+ long a;
+ long b;
+ long c;
+};
+
+struct foo
+test(long a, long b, long c, long d, long e, long f, long g, long h)
+{
+ printf("%ld %ld %ld %ld %ld %ld %ld %ld\n", a, b, c, d, e, f, g, h);
+ for (;;)
+ sleep(60);
+}
+
+int
+main(int argc, char **argv)
+{
+ test(1, 2, 3, 4, 5, 6, 7, 8);
+ return (0);
+}
diff --git a/usr/src/common/saveargs/tests/functional/big-struct-ret.c b/usr/src/common/saveargs/tests/functional/big-struct-ret.c
new file mode 100644
index 0000000000..0953622f0d
--- /dev/null
+++ b/usr/src/common/saveargs/tests/functional/big-struct-ret.c
@@ -0,0 +1,38 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2012, Richard Lowe.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+struct foo {
+ long a;
+ long b;
+ long c;
+};
+
+struct foo
+test(long a, long b, long c, long d)
+{
+ printf("%ld %ld %ld %ld\n", a, b, c, d);
+ for (;;)
+ sleep(60);
+}
+
+int
+main(int argc, char **argv)
+{
+ test(1, 2, 3, 4);
+ return (0);
+}
diff --git a/usr/src/common/saveargs/tests/functional/small-struct-ret-and-spill.c b/usr/src/common/saveargs/tests/functional/small-struct-ret-and-spill.c
new file mode 100644
index 0000000000..6cbc0cde47
--- /dev/null
+++ b/usr/src/common/saveargs/tests/functional/small-struct-ret-and-spill.c
@@ -0,0 +1,37 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2012, Richard Lowe.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+struct foo {
+ long a;
+ long b;
+};
+
+struct foo
+test(long a, long b, long c, long d, long e, long f, long g, long h)
+{
+ printf("%ld %ld %ld %ld %ld %ld %ld %ld\n", a, b, c, d, e, f, g, h);
+ for (;;)
+ sleep(60);
+}
+
+int
+main(int argc, char **argv)
+{
+ test(1, 2, 3, 4, 5, 6, 7, 8);
+ return (0);
+}
diff --git a/usr/src/common/saveargs/tests/functional/small-struct-ret.c b/usr/src/common/saveargs/tests/functional/small-struct-ret.c
new file mode 100644
index 0000000000..3731365f11
--- /dev/null
+++ b/usr/src/common/saveargs/tests/functional/small-struct-ret.c
@@ -0,0 +1,37 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2012, Richard Lowe.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+struct foo {
+ long a;
+ long b;
+};
+
+struct foo
+test(long a, long b, long c, long d)
+{
+ printf("%ld %ld %ld %ld\n", a, b, c, d);
+ for (;;)
+ sleep(60);
+}
+
+int
+main(int argc, char **argv)
+{
+ test(1, 2, 3, 4);
+ return (0);
+}
diff --git a/usr/src/common/saveargs/tests/functional/stack-spill.c b/usr/src/common/saveargs/tests/functional/stack-spill.c
new file mode 100644
index 0000000000..4324d60c27
--- /dev/null
+++ b/usr/src/common/saveargs/tests/functional/stack-spill.c
@@ -0,0 +1,32 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2012, Richard Lowe.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+int
+test(long a, long b, long c, long d, long e, long f, long g, long h)
+{
+ printf("%ld %ld %ld %ld %ld %ld %ld %ld\n", a, b, c, d, e, f, g, h);
+ for (;;)
+ sleep(60);
+}
+
+int
+main(int argc, char **argv)
+{
+ test(1, 2, 3, 4, 5, 6, 7, 8);
+ return (0);
+}
diff --git a/usr/src/common/saveargs/tests/functional/test.sh b/usr/src/common/saveargs/tests/functional/test.sh
new file mode 100644
index 0000000000..dea1059b2c
--- /dev/null
+++ b/usr/src/common/saveargs/tests/functional/test.sh
@@ -0,0 +1,37 @@
+#! /usr/bin/ksh
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2012, Richard Lowe.
+#
+
+function tester {
+ prog=${1}
+ pattern=${2}
+
+ ./$prog >/dev/null &
+ pid=$!
+ if (/usr/bin/amd64/pstack $pid | /usr/xpg4/bin/grep -q "${pattern}"); then
+ echo "pass: ${prog}"
+ else
+ echo "FAIL: ${prog}"
+ fi
+ kill $pid
+}
+
+tester align "test (1, 2, 3, 4, 5)"
+tester basic "test (1, 2, 3, 4)"
+tester big-struct-ret "test (1, 2, 3, 4)"
+tester big-struct-ret-and-spill "test (1, 2, 3, 4, 5, 6, 7, 8)"
+tester small-struct-ret "test (1, 2, 3, 4)"
+tester small-struct-ret-and-spill "test (1, 2, 3, 4, 5, 6, 7, 8)"
+tester stack-spill "test (1, 2, 3, 4, 5, 6, 7, 8)"