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

23d3c3
From c11acce7e2786ab8105c02318592713e51e7991c Mon Sep 17 00:00:00 2001
23d3c3
From: Jakub Filak <jfilak@redhat.com>
23d3c3
Date: Sat, 18 Jan 2014 00:06:47 +0100
23d3c3
Subject: [PATCH 33/39] Add test for analysis tool
23d3c3
23d3c3
Related to #29
23d3c3
Related to rhbz#1054737
23d3c3
---
23d3c3
 test/CMakeLists.txt                                   |  8 ++++++++
23d3c3
 test/analysis_testdriver                              | 19 +++++++++++++++++++
23d3c3
 .../backtrace_not_reportable_1remote_class.log.in     |  5 +++++
23d3c3
 .../backtrace_not_reportable_3remote_classes.log.in   |  5 +++++
23d3c3
 test/outputs/not_reportable_1remote_class.log.in      |  1 +
23d3c3
 test/outputs/not_reportable_3remote_classes.log.in    |  1 +
23d3c3
 6 files changed, 39 insertions(+)
23d3c3
 create mode 100644 test/analysis_testdriver
23d3c3
 create mode 100644 test/outputs/backtrace_not_reportable_1remote_class.log.in
23d3c3
 create mode 100644 test/outputs/backtrace_not_reportable_3remote_classes.log.in
23d3c3
 create mode 100644 test/outputs/not_reportable_1remote_class.log.in
23d3c3
 create mode 100644 test/outputs/not_reportable_3remote_classes.log.in
23d3c3
23d3c3
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
23d3c3
index 1a851e6..0439294 100644
23d3c3
--- a/test/CMakeLists.txt
23d3c3
+++ b/test/CMakeLists.txt
23d3c3
@@ -1,3 +1,5 @@
23d3c3
+project(test)
23d3c3
+
23d3c3
 set(HTTP_DIR "/var/www/html")
23d3c3
 set(SERVER_URL "http://localhost")
23d3c3
 
23d3c3
@@ -114,6 +116,10 @@ function(_add_test target_name expected_exit_code)
23d3c3
     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})
23d3c3
 endfunction()
23d3c3
 
23d3c3
+function(_add_analyze_test target_name)
23d3c3
+    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)
23d3c3
+endfunction()
23d3c3
+
23d3c3
 _add_test_target(
23d3c3
     run
23d3c3
     SimpleTest
23d3c3
@@ -308,6 +314,8 @@ _add_test_target(
23d3c3
 )
23d3c3
 _add_test(run_remote_thread 0)
23d3c3
 
23d3c3
+_add_analyze_test(not_reportable_1remote_class)
23d3c3
+_add_analyze_test(not_reportable_3remote_classes)
23d3c3
 
23d3c3
 get_directory_property(all_run_targets ALL_RUN_TARGETS)
23d3c3
 add_custom_target(run_all DEPENDS ${all_run_targets})
23d3c3
diff --git a/test/analysis_testdriver b/test/analysis_testdriver
23d3c3
new file mode 100644
23d3c3
index 0000000..3888b6c
23d3c3
--- /dev/null
23d3c3
+++ b/test/analysis_testdriver
23d3c3
@@ -0,0 +1,19 @@
23d3c3
+#!/bin/sh
23d3c3
+# Help:
23d3c3
+#   $1 - path to analysis tool
23d3c3
+#   $2 - path to input file
23d3c3
+#   $3 - path to output log file
23d3c3
+#   $4 - path to expected output log file
23d3c3
+#
23d3c3
+
23d3c3
+$1/abrt-action-analyze-java -f $2 -o > $3 || exit 1
23d3c3
+
23d3c3
+diff -u $4 $3
23d3c3
+EC=$?
23d3c3
+
23d3c3
+if [ 0 -ne $EC ]; then
23d3c3
+    echo "Expected $4 differs from result $3"
23d3c3
+    exit 1
23d3c3
+fi
23d3c3
+
23d3c3
+exit 0
23d3c3
diff --git a/test/outputs/backtrace_not_reportable_1remote_class.log.in b/test/outputs/backtrace_not_reportable_1remote_class.log.in
23d3c3
new file mode 100644
23d3c3
index 0000000..5555da5
23d3c3
--- /dev/null
23d3c3
+++ b/test/outputs/backtrace_not_reportable_1remote_class.log.in
23d3c3
@@ -0,0 +1,5 @@
23d3c3
+Exception in thread "Thread-3" java.lang.ArrayIndexOutOfBoundsException: 42
23d3c3
+>---at SimpleTest.throwIndexOutOfBoundsException(SimpleTest.java:24) [jar:http://localhost:54321/JarTest.jar!/SimpleTest.class]
23d3c3
+>---at SimpleTest.catchIndexOutOfBoundsException(SimpleTest.java:47) [jar:http://localhost:54321/JarTest.jar!/SimpleTest.class]
23d3c3
+>---at SimpleTest.throwAndCatchAllExceptions(SimpleTest.java:61) [jar:http://localhost:54321/JarTest.jar!/SimpleTest.class]
23d3c3
+>---at ThreadCaughtException.run(ThreadCaughtException.java:7) [jar:http://localhost:54321/JarTest.jar!/ThreadCaughtException.class]
23d3c3
diff --git a/test/outputs/backtrace_not_reportable_3remote_classes.log.in b/test/outputs/backtrace_not_reportable_3remote_classes.log.in
23d3c3
new file mode 100644
23d3c3
index 0000000..77fb989
23d3c3
--- /dev/null
23d3c3
+++ b/test/outputs/backtrace_not_reportable_3remote_classes.log.in
23d3c3
@@ -0,0 +1,5 @@
23d3c3
+Exception in thread "Thread-3" java.lang.ArrayIndexOutOfBoundsException: 42
23d3c3
+>---at SimpleTest.throwIndexOutOfBoundsException(SimpleTest.java:24) [jar:http://localhost:54321/JarTest.jar!/SimpleTest.class]
23d3c3
+>---at SimpleTest.catchIndexOutOfBoundsException(SimpleTest.java:47) [jar:http://localhost:321/JarTest.jar!/SimpleTest.class]
23d3c3
+>---at SimpleTest.throwAndCatchAllExceptions(SimpleTest.java:61) [jar:http://localhost:4321/JarTest.jar!/SimpleTest.class]
23d3c3
+>---at ThreadCaughtException.run(ThreadCaughtException.java:7) [jar:http://localhost:54321/JarTest.jar!/ThreadCaughtException.class]
23d3c3
diff --git a/test/outputs/not_reportable_1remote_class.log.in b/test/outputs/not_reportable_1remote_class.log.in
23d3c3
new file mode 100644
23d3c3
index 0000000..282933a
23d3c3
--- /dev/null
23d3c3
+++ b/test/outputs/not_reportable_1remote_class.log.in
23d3c3
@@ -0,0 +1 @@
23d3c3
+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.
23d3c3
diff --git a/test/outputs/not_reportable_3remote_classes.log.in b/test/outputs/not_reportable_3remote_classes.log.in
23d3c3
new file mode 100644
23d3c3
index 0000000..7489f74
23d3c3
--- /dev/null
23d3c3
+++ b/test/outputs/not_reportable_3remote_classes.log.in
23d3c3
@@ -0,0 +1 @@
23d3c3
+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.
23d3c3
-- 
23d3c3
1.8.3.1
23d3c3