methods2test icon indicating copy to clipboard operation
methods2test copied to clipboard

Add compatibility with macOS

Open boraelci opened this issue 2 years ago • 1 comments

Fixes #5

  1. Running find_map_test_cases.py was producing the following error:
OSError: dlopen(/Users/boraelci/methods2test/scripts/java-grammar.so, 0x0006): tried: '/Users/boraelci/methods2test/scripts/java-grammar.so' (not a mach-o file), '/usr/lib/java-grammar.so' (no such file)

I found out that the (not a mach-o file) part indicates an issue with macOS compatibility. I compiled the java language with tree-sitter using gcc -shared -o libtree-sitter-java.dylib -Isrc src/parser.c. I committed the resulting file, which should be passed into the --grammar argument when running the script on macOS. As a result, grammar file is loaded correctly.

  1. find command was not working, so I added if statement that checks if the platform is macOS and uses a different syntax.

  2. No tests_norm was being found in focals_norm. This is probably due to the different formats returned by grep in different platforms. I added an if statement that checks if the platform is macOS and removes the ./ from the beginning of the test file path.

  3. The default value for the --grammar argument was not working because it required an absolute path. I added an if statement that checks if the given path is not absolute, and in that case prefixes it with the absolute path of the current working directory.

  4. Fixed a few typos in README

I tested these changes on the hadoop repository. The tests are successfully identified and correctly mapped to classes and methods.

boraelci avatar May 03 '23 14:05 boraelci

@microsoft-github-policy-service agree

boraelci avatar May 03 '23 14:05 boraelci