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

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