diff options
author | William Douglas <william.douglas@intel.com> | 2012-05-24 14:31:35 -0700 |
---|---|---|
committer | William Douglas <william.douglas@intel.com> | 2012-05-24 14:31:35 -0700 |
commit | 60e1a8cff19dd42c736d83b03afb530bee243bd6 (patch) | |
tree | 87be48ccb588ca2f867ea57d225d65f47d7cde42 | |
parent | b92d5b5b092aec634913ebee3533b435425ec4b7 (diff) | |
download | corewatcher-60e1a8cff19dd42c736d83b03afb530bee243bd6.tar.gz corewatcher-60e1a8cff19dd42c736d83b03afb530bee243bd6.tar.bz2 corewatcher-60e1a8cff19dd42c736d83b03afb530bee243bd6.zip |
add test that generates a core for corewatcher
Signed-off-by: William Douglas <william.douglas@intel.com>
-rw-r--r-- | tests/bad-write.c | 11 | ||||
-rwxr-xr-x | tests/run-test.sh | 12 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/bad-write.c b/tests/bad-write.c new file mode 100644 index 0000000..5f63e80 --- /dev/null +++ b/tests/bad-write.c @@ -0,0 +1,11 @@ +#include <unistd.h> +#include <stdio.h> + +int main(void) +{ + char *c = NULL; + + c[0] = 'a'; + + return 0; +} diff --git a/tests/run-test.sh b/tests/run-test.sh new file mode 100755 index 0000000..781fb81 --- /dev/null +++ b/tests/run-test.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +exec 2> /dev/null +ulimit -c unlimited + +original_core_pattern=$(cat /proc/sys/kernel/core_pattern) + +sudo echo "$PWD/core" | sudo tee /proc/sys/kernel/core_pattern > /dev/null + +./bad-write + +sudo echo "$original_core_pattern" | sudo tee /proc/sys/kernel/core_pattern > /dev/null |