Blame SOURCES/0033-Add-test-for-analysis-tool.patch

b35d98
From c11acce7e2786ab8105c02318592713e51e7991c Mon Sep 17 00:00:00 2001
b35d98
From: Jakub Filak <jfilak@redhat.com>
b35d98
Date: Sat, 18 Jan 2014 00:06:47 +0100
b35d98
Subject: [PATCH 33/39] Add test for analysis tool
b35d98
b35d98
Related to #29
b35d98
Related to rhbz#1054737
b35d98
---
b35d98
 test/CMakeLists.txt                                   |  8 ++++++++
b35d98
 test/analysis_testdriver                              | 19 +++++++++++++++++++
b35d98
 .../backtrace_not_reportable_1remote_class.log.in     |  5 +++++
b35d98
 .../backtrace_not_reportable_3remote_classes.log.in   |  5 +++++
b35d98
 test/outputs/not_reportable_1remote_class.log.in      |  1 +
b35d98
 test/outputs/not_reportable_3remote_classes.log.in    |  1 +
b35d98
 6 files changed, 39 insertions(+)
b35d98
 create mode 100644 test/analysis_testdriver
b35d98
 create mode 100644 test/outputs/backtrace_not_reportable_1remote_class.log.in
b35d98
 create mode 100644 test/outputs/backtrace_not_reportable_3remote_classes.log.in
b35d98
 create mode 100644 test/outputs/not_reportable_1remote_class.log.in
b35d98
 create mode 100644 test/outputs/not_reportable_3remote_classes.log.in
b35d98
b35d98
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
b35d98
index 1a851e6..0439294 100644
b35d98
--- a/test/CMakeLists.txt
b35d98
+++ b/test/CMakeLists.txt
b35d98
@@ -1,3 +1,5 @@
b35d98
+project(test)
b35d98
+
b35d98
 set(HTTP_DIR "/var/www/html")
b35d98
 set(SERVER_URL "http://localhost")
b35d98
 
b35d98
@@ -114,6 +116,10 @@ function(_add_test target_name expected_exit_code)
b35d98
     add_test(test_${target_name} /bin/sh ${CMAKE_CURRENT_SOURCE_DIR}/testdriver ${target_name} ${expected_exit_code} ${CMAKE_CURRENT_BINARY_DIR}/outputs/${target_name}.log ${CMAKE_CURRENT_BINARY_DIR}/${target_name}.log ${ARGN})
b35d98
 endfunction()
b35d98
 
b35d98
+function(_add_analyze_test target_name)
b35d98
+    add_test(test_${target_name} /bin/sh ${CMAKE_CURRENT_SOURCE_DIR}/analysis_testdriver ${CMAKE_BINARY_DIR}/utils ${test_BINARY_DIR}/outputs/backtrace_${target_name}.log ${test_BINARY_DIR}/${target_name}.log ${test_BINARY_DIR}/outputs/${target_name}.log)
b35d98
+endfunction()
b35d98
+
b35d98
 _add_test_target(
b35d98
     run
b35d98
     SimpleTest
b35d98
@@ -308,6 +314,8 @@ _add_test_target(
b35d98
 )
b35d98
 _add_test(run_remote_thread 0)
b35d98
 
b35d98
+_add_analyze_test(not_reportable_1remote_class)
b35d98
+_add_analyze_test(not_reportable_3remote_classes)
b35d98
 
b35d98
 get_directory_property(all_run_targets ALL_RUN_TARGETS)
b35d98
 add_custom_target(run_all DEPENDS ${all_run_targets})
b35d98
diff --git a/test/analysis_testdriver b/test/analysis_testdriver
b35d98
new file mode 100644
b35d98
index 0000000..3888b6c
b35d98
--- /dev/null
b35d98
+++ b/test/analysis_testdriver
b35d98
@@ -0,0 +1,19 @@
b35d98
+#!/bin/sh
b35d98
+# Help:
b35d98
+#   $1 - path to analysis tool
b35d98
+#   $2 - path to input file
b35d98
+#   $3 - path to output log file
b35d98
+#   $4 - path to expected output log file
b35d98
+#
b35d98
+
b35d98
+$1/abrt-action-analyze-java -f $2 -o > $3 || exit 1
b35d98
+
b35d98
+diff -u $4 $3
b35d98
+EC=$?
b35d98
+
b35d98
+if [ 0 -ne $EC ]; then
b35d98
+    echo "Expected $4 differs from result $3"
b35d98
+    exit 1
b35d98
+fi
b35d98
+
b35d98
+exit 0
b35d98
diff --git a/test/outputs/backtrace_not_reportable_1remote_class.log.in b/test/outputs/backtrace_not_reportable_1remote_class.log.in
b35d98
new file mode 100644
b35d98
index 0000000..5555da5
b35d98
--- /dev/null
b35d98
+++ b/test/outputs/backtrace_not_reportable_1remote_class.log.in
b35d98
@@ -0,0 +1,5 @@
b35d98
+Exception in thread "Thread-3" java.lang.ArrayIndexOutOfBoundsException: 42
b35d98
+>---at SimpleTest.throwIndexOutOfBoundsException(SimpleTest.java:24) [jar:http://localhost:54321/JarTest.jar!/SimpleTest.class]
b35d98
+>---at SimpleTest.catchIndexOutOfBoundsException(SimpleTest.java:47) [jar:http://localhost:54321/JarTest.jar!/SimpleTest.class]
b35d98
+>---at SimpleTest.throwAndCatchAllExceptions(SimpleTest.java:61) [jar:http://localhost:54321/JarTest.jar!/SimpleTest.class]
b35d98
+>---at ThreadCaughtException.run(ThreadCaughtException.java:7) [jar:http://localhost:54321/JarTest.jar!/ThreadCaughtException.class]
b35d98
diff --git a/test/outputs/backtrace_not_reportable_3remote_classes.log.in b/test/outputs/backtrace_not_reportable_3remote_classes.log.in
b35d98
new file mode 100644
b35d98
index 0000000..77fb989
b35d98
--- /dev/null
b35d98
+++ b/test/outputs/backtrace_not_reportable_3remote_classes.log.in
b35d98
@@ -0,0 +1,5 @@
b35d98
+Exception in thread "Thread-3" java.lang.ArrayIndexOutOfBoundsException: 42
b35d98
+>---at SimpleTest.throwIndexOutOfBoundsException(SimpleTest.java:24) [jar:http://localhost:54321/JarTest.jar!/SimpleTest.class]
b35d98
+>---at SimpleTest.catchIndexOutOfBoundsException(SimpleTest.java:47) [jar:http://localhost:321/JarTest.jar!/SimpleTest.class]
b35d98
+>---at SimpleTest.throwAndCatchAllExceptions(SimpleTest.java:61) [jar:http://localhost:4321/JarTest.jar!/SimpleTest.class]
b35d98
+>---at ThreadCaughtException.run(ThreadCaughtException.java:7) [jar:http://localhost:54321/JarTest.jar!/ThreadCaughtException.class]
b35d98
diff --git a/test/outputs/not_reportable_1remote_class.log.in b/test/outputs/not_reportable_1remote_class.log.in
b35d98
new file mode 100644
b35d98
index 0000000..282933a
b35d98
--- /dev/null
b35d98
+++ b/test/outputs/not_reportable_1remote_class.log.in
b35d98
@@ -0,0 +1 @@
b35d98
+This problem can be caused by a 3rd party code from the jar/class at http://localhost:54321/JarTest.jar. In order to provide valuable problem reports, ABRT will not allow you to submit this problem. If you still want to participate in solving this problem, please contact the developers directly.
b35d98
diff --git a/test/outputs/not_reportable_3remote_classes.log.in b/test/outputs/not_reportable_3remote_classes.log.in
b35d98
new file mode 100644
b35d98
index 0000000..7489f74
b35d98
--- /dev/null
b35d98
+++ b/test/outputs/not_reportable_3remote_classes.log.in
b35d98
@@ -0,0 +1 @@
b35d98
+This problem can be caused by a 3rd party code from the jar/class at http://localhost:54321/JarTest.jar, http://localhost:321/JarTest.jar, http://localhost:4321/JarTest.jar. In order to provide valuable problem reports, ABRT will not allow you to submit this problem. If you still want to participate in solving this problem, please contact the developers directly.
b35d98
-- 
b35d98
1.8.3.1
b35d98