OMRChecker is a clang-based linter tool. Its pupose is to catch any extensible class hierarchy implementation/usage errors. It is currently enabled and run for any PR created in the eclipse/omr project, such as this one:
https://travis-ci.org/eclipse/omr/jobs/308654788
Since eclipse/openj9 also uses extensible class hierarchy and derives a number of classes from eclipse/omr, OMRChecker should be enabled and run for eclipse/openj9 PRs as well.
@xliang6 How long does the checker take to run on the OpenJ9 code base? Which platforms can the checker run on?
FYI @AdamBrousseau This may need your help to enable on Jenkins.
I was able to run the linter for OpenJ9 for Linux on x86_64 manually using the steps below, thanks to the help I received from @mgaudet and the build instructions here.
Not sure how long it would take on Jenkins or Travis CI, but the checker took ~5 minutes to run on the OpenJ9 code base on the linux machine I used.
Here are the steps to run the linter manually:
git clone https://github.com/ibmruntimes/openj9-openjdk-jdk9.gitdocker build -t openj9build -f Dockerfile .docker run --rm -it -v$PWD:/sandbox -v$HOME/open/jdk-9+181.openj9:/sdk openj9build /bin/bashapt-get update && apt-get install clang-3.8 llvm-3.8 libclang-3.8-dev llvm-3.8-devroot@9280bacfa0b7:~# cd /sandbox/openj9-openjdk-jdk9/root@9280bacfa0b7:/sandbox/openj9-openjdk-jdk9/# bash ./get_source.shroot@9280bacfa0b7:/sandbox/openj9-openjdk-jdk9/# bash ./configure --with-freemarker-jar=/root/freemarker.jarroot@9280bacfa0b7:/sandbox/openj9-openjdk-jdk9/# make imagesbuild/. It should be in build/linux-x86_64-normal-server-release/vm/compiler/trj9openj9-openjdk-jdk9/omr/tools/compiler/OMRChecker/ modify the variable base in the constructor for class OMRChecker such that it looks like this:class OMRChecker(tool.Tool):
'''A wrapper providing an interface for interacting with OMRChecker.'''
def __init__(self, checker):
base = [os.environ['CLANG'], '-fsyntax-only', '-Xclang', '-load', '-Xclang', checker, '-Xclang', '-add-plugin', '-Xclang', 'omr-checker']
super(OMRChecker, self).__init__(lambda args: base + args)
Makefile to build the plugin shared library object using clang-3.8. For that, you would have to replace CXX under # Build rules with CLANG. It should look like this:#
# Build rules
#
$(OMRCHECKER_OBJECT): $(CHECKER_O)
$(CLANG) $(LDFLAGS) -o $@ $^
$(CHECKER_O): $(CHECKER_CPP) $(CHECKER_HPP)
$(CLANG) $(CXXFLAGS) -c -o $@ $<
/build/linux-x86_64-normal-server-release/vm/compiler/trj9export J9SRC=/sandbox/openj9-openjdk-jdk9/build/linux-x86_64-normal-server-release/vm/ OMRCHECKER_DIR=/sandbox/openj9-openjdk-jdk9/omr/tools/compiler/OMRChecker/ LLVM_CONFIG=llvm-config-3.8 CLANG=clang++-3.8 CXX_PATH=clang++-3.8root@9280bacfa0b7:/sandbox/openj9-openjdk-jdk9/build/linux-x86_64-normal-server-release/vm/compiler/trj9# make -f linter.mk@DanHeidinga AFAIK the checker was only run on x86-64 Linux platform.
@xliang6 Can you propose the required changes to travis.yaml file to get this enabled?
@DanHeidinga I will work with @nbhuiyan. We need to first run the checker on current openj9 source code and fix any errors the tool finds before we enable it as a part of the travis ci build process.
Closing as complete.
Most helpful comment
@DanHeidinga I will work with @nbhuiyan. We need to first run the checker on current openj9 source code and fix any errors the tool finds before we enable it as a part of the travis ci build process.