Blame SOURCES/0025-Update-the-missing-class-test.patch

23d3c3
From 888f4a58a82e2d265fc95907492a24c95978e605 Mon Sep 17 00:00:00 2001
23d3c3
From: Jakub Filak <jfilak@redhat.com>
23d3c3
Date: Fri, 17 Jan 2014 14:20:51 +0100
23d3c3
Subject: [PATCH 25/39] Update the missing class test
23d3c3
23d3c3
The ClassNotFound exception which is thrown in case of a not existing
23d3c3
main class file is caught by Java Native Interface and java process
23d3c3
exits gracefully with an error message:
23d3c3
23d3c3
Error: Could not find or load main class MissingClassTest
23d3c3
23d3c3
It doesn't make sense to report such exceptions because this exception
23d3c3
would be reported every time when someone run "java foo" where 'foo'
23d3c3
does not exist.
23d3c3
23d3c3
Just for the record, ABRT doesn't detect the similar problem in python.
23d3c3
23d3c3
$ python foo
23d3c3
python: can't open file 'foo': [Errno 2] No such file or directory
23d3c3
23d3c3
Related to rhbz#1051198
23d3c3
---
23d3c3
 test/CMakeLists.txt                        | 20 ++++++++++++++------
23d3c3
 test/outputs/run_missing_class_test.log.in | 10 ----------
23d3c3
 2 files changed, 14 insertions(+), 16 deletions(-)
23d3c3
 delete mode 100644 test/outputs/run_missing_class_test.log.in
23d3c3
23d3c3
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
23d3c3
index 5267e7b..1a851e6 100644
23d3c3
--- a/test/CMakeLists.txt
23d3c3
+++ b/test/CMakeLists.txt
23d3c3
@@ -171,14 +171,22 @@ _add_test_target(
23d3c3
 )
23d3c3
 _add_test(run_bad_class 2)
23d3c3
 
23d3c3
-_add_test_target(
23d3c3
+# Disabled because JVM catches the ClassNotFoundException in a native method and exits gracefully
23d3c3
+#_add_test_target(
23d3c3
+#    run_missing_class_test
23d3c3
+#    MissingClassTest
23d3c3
+#    PRE rm -f MissingClassTest.class
23d3c3
+#    DEPENDS ${TEST_JAVA_TARGETS} ${JAR_TEST_PATH}
23d3c3
+#    AGENT_OPTIONS executable=threadclass
23d3c3
+#)
23d3c3
+#_add_test(run_missing_class_test 2)
23d3c3
+add_custom_target(
23d3c3
     run_missing_class_test
23d3c3
-    MissingClassTest
23d3c3
-    PRE rm -f MissingClassTest.class
23d3c3
-    DEPENDS ${TEST_JAVA_TARGETS} ${JAR_TEST_PATH}
23d3c3
-    AGENT_OPTIONS executable=threadclass
23d3c3
+    COMMAND rm -f MissingClassTest.class && LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/src ${Java_JAVA_EXECUTABLE} -agentlib:${AGENT_NAME}=output=run_missing_class.log MissingClassTest || test ! -e run_missing_class.log
23d3c3
+    DEPENDS AbrtChecker ${TEST_JAVA_TARGETS}
23d3c3
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
23d3c3
 )
23d3c3
-_add_test(run_missing_class_test 2)
23d3c3
+add_test(test_run_missing_class_test make run_missing_class_test)
23d3c3
 
23d3c3
 _add_test_target(
23d3c3
     run_try_finally
23d3c3
diff --git a/test/outputs/run_missing_class_test.log.in b/test/outputs/run_missing_class_test.log.in
23d3c3
deleted file mode 100644
23d3c3
index ea3dc25..0000000
23d3c3
--- a/test/outputs/run_missing_class_test.log.in
23d3c3
+++ /dev/null
23d3c3
@@ -1,10 +0,0 @@
23d3c3
-Uncaught exception java.lang.ClassNotFoundException in method java.lang.ClassLoader.loadClass()
23d3c3
-Exception in thread "main" java.lang.ClassNotFoundException: MissingClassTest
23d3c3
-	at java.net.URLClassLoader$1.run(URLClassLoader.java:LINENO) [jar:file:JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar!/java/net/URLClassLoader$1.class]
23d3c3
-	at java.net.URLClassLoader$1.run(URLClassLoader.java:LINENO) [jar:file:JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar!/java/net/URLClassLoader$1.class]
23d3c3
-	at java.security.AccessController.doPrivileged(Native Method) [jar:file:JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar!/java/security/AccessController.class]
23d3c3
-	at java.net.URLClassLoader.findClass(URLClassLoader.java:LINENO) [jar:file:JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar!/java/net/URLClassLoader.class]
23d3c3
-	at java.lang.ClassLoader.loadClass(ClassLoader.java:LINENO) [jar:file:JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar!/java/lang/ClassLoader.class]
23d3c3
-	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:LINENO) [jar:file:JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar!/sun/misc/Launcher$AppClassLoader.class]
23d3c3
-	at java.lang.ClassLoader.loadClass(ClassLoader.java:LINENO) [jar:file:JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar!/java/lang/ClassLoader.class]
23d3c3
-executable: JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar
23d3c3
-- 
23d3c3
1.8.3.1
23d3c3