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

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