From 814bc89d4635f101b2c0077598f31aad95ed15b7 Mon Sep 17 00:00:00 2001 From: fche Date: Sat, 12 Aug 2006 05:13:09 +0000 Subject: 2006-08-12 Frank Ch. Eigler * configure.ac, Makefile.am: Descend into testsuite/ directory. Remove local test logic. * configure, Makefile.in: Regenerated. * runtest.sh: Not yet removed. * HACKING: Update for new testsuite layout. 2006-08-12 Frank Ch. Eigler * all: Reorganized old pass-1..4 tests one dejagnu bucket. Moved over old pass-5 tests, except for disabled syscalls tests. * Makefile (installcheck): New target for running pass-1..5 tests against installed systemtap. --- testsuite/systemtap.stress/current.stp | 97 ++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 testsuite/systemtap.stress/current.stp (limited to 'testsuite/systemtap.stress/current.stp') diff --git a/testsuite/systemtap.stress/current.stp b/testsuite/systemtap.stress/current.stp new file mode 100644 index 00000000..40673581 --- /dev/null +++ b/testsuite/systemtap.stress/current.stp @@ -0,0 +1,97 @@ +/* + * current.stp (requires Guru mode) + * + * Test the validity of the current pointer in various contexts. + */ + +global length + +function commlen:long () %{ + THIS->__retvalue = strlen(current->comm); +%} + +function pcommlen:long () %{ + THIS->__retvalue = strlen(current->parent->comm); +%} + +probe begin { log("systemtap starting probe") } + +probe + timer.profile, + %( arch != "x86_64" %? + # __switch_to.return is broken on x86_64 - see PR2068 + %( arch != "ia64" %? + # __switch_to is macro definition in ia64, + # and ia64_switch_to is defined in assemble language + kernel.function("__switch_to"), + kernel.function("__switch_to").return, + %) + %) + + /* XXX + * It would be nice if we could just do this: + * kernel.statement("__switch_to@*:*") + * to probe every line in the function + */ + + /* add other kernels/archs here as desired... */ + %( arch == "x86_64" %? + %( kernel_vr == "2.6.9-22.ELsmp" %? + /* the lines before, at, and after the update of pcurrent */ + kernel.statement("__switch_to@arch/x86_64/kernel/process.c:508"), + kernel.statement("__switch_to@arch/x86_64/kernel/process.c:509"), + kernel.statement("__switch_to@arch/x86_64/kernel/process.c:510"), + %) + %( kernel_vr == "2.6.9-24.ELsmp" %? + /* the lines before, at, and after the update of pcurrent */ + kernel.statement("__switch_to@arch/x86_64/kernel/process.c:501"), + kernel.statement("__switch_to@arch/x86_64/kernel/process.c:502"), + kernel.statement("__switch_to@arch/x86_64/kernel/process.c:503"), + %) + %) + + kernel.function("*@kernel/sched.c"), + kernel.function("*@kernel/sched.c").return, + module("*").function("*interrupt*"), + module("*").function("*interrupt*").return +{ + length <<< commlen() + length <<< pcommlen() +} + +function get_TASK_COMM_LEN:long() %{ + /* TASK_COMM_LEN was introduced in 2.6.11, before which + * the length of the comm string was hard-coded to 16 */ +#ifdef TASK_COMM_LEN + THIS->__retvalue = TASK_COMM_LEN; +#else + THIS->__retvalue = 16; +#endif +%} + +probe end { + log("systemtap ending probe") + printf("count = %d\n", @count(length)) + printf("sum = %d\n", @sum(length)) + printf("min = %d\n", @min(length)) + printf("max = %d\n", @max(length)) + printf("avg = %d\n", @avg(length)) + + /* + * Check that the min & max lengths look reasonable. If any string was + * either empty or too big, then the current pointer probably wasn't + * valid, even though it dereferenced without crashing. + */ + if (@min(length) > 0) { + log("systemtap test success") + } else { + log("unexpected minimum length") + log("systemtap test failure") + } + if (@max(length) < get_TASK_COMM_LEN()) { + log("systemtap test success") + } else { + log("unexpected maximum length") + log("systemtap test failure") + } +} -- cgit