mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 01:11:10 +03:00
java: Added sanity checks and integrated them in CMake. Updated sample names and sample mapping.
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
46996e5251
commit
40f9135412
44
tests/check_autoloadlibrary.py
Executable file
44
tests/check_autoloadlibrary.py
Executable file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import unittest as u
|
||||
import re, fnmatch, os
|
||||
|
||||
rootDir = '../src/'
|
||||
prefix = """
|
||||
%pragma(java) jniclasscode=%{
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary(\""""
|
||||
|
||||
sufix = """\");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. \\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
%}"""
|
||||
|
||||
class AutoLoadLibrary(u.TestCase):
|
||||
|
||||
def test_existing_snippet(self):
|
||||
broken_modules = []
|
||||
|
||||
for subdir, dirs, files in os.walk(rootDir):
|
||||
for fileName in files:
|
||||
if fnmatch.fnmatch(fileName, 'javaupm_*.i'):
|
||||
moduleName = fileName[:-2]
|
||||
snippet = prefix + moduleName + sufix
|
||||
|
||||
with open(os.path.join(subdir, fileName), "r") as f:
|
||||
if not snippet in f.read():
|
||||
broken_modules.append(moduleName)
|
||||
|
||||
self.assertEqual( len(broken_modules), 0,
|
||||
"\nThe following modules do not contain the standard auto load library code:\n" + \
|
||||
"\n".join(broken_modules) + \
|
||||
"\nConsider adding the following snippet to the SWIG interface file:\n" + \
|
||||
prefix + "<module_name>" + sufix)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
u.main()
|
Reference in New Issue
Block a user