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

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