Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when trying to load a .so file #36

Closed
boxed opened this issue Nov 18, 2018 · 4 comments
Closed

Crash when trying to load a .so file #36

boxed opened this issue Nov 18, 2018 · 4 comments

Comments

@boxed
Copy link

boxed commented Nov 18, 2018

I am attempting to use mutpy on tri.struct (I have to use the externalize-test-runner-branch), but I am getting this crash:

> mut.py --runner pytest --target tri.struct --unit-test tests          189ms  Sun Nov 18 15:10:02 2018
[*] Start mutation process:
   - targets: tri.struct
   - tests: tests
[*] 55 tests passed:
   - tests.test_struct [0.36612 s]
[*] Start mutants generation and execution:
Traceback (most recent call last):
  File "/Users/boxed/Projects/tri.struct/venv/bin/mut.py", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/Users/boxed/Projects/mutpy/bin/mut.py", line 7, in <module>
    commandline.main(sys.argv)
  File "/Users/boxed/Projects/mutpy/mutpy/commandline.py", line 10, in main
    run_mutpy(parser)
  File "/Users/boxed/Projects/mutpy/mutpy/commandline.py", line 62, in run_mutpy
    mutation_controller.run()
  File "/Users/boxed/Projects/mutpy/mutpy/controller.py", line 66, in run
    self.run_mutation_process()
  File "/Users/boxed/Projects/mutpy/mutpy/controller.py", line 85, in run_mutation_process
    self.mutate_module(target_module, to_mutate, total_duration)
  File "/Users/boxed/Projects/mutpy/mutpy/utils.py", line 247, in __call__
    result = self.method(*args, **kwargs)
  File "/Users/boxed/Projects/mutpy/mutpy/controller.py", line 109, in mutate_module
    target_ast = self.create_target_ast(target_module)
  File "/Users/boxed/Projects/mutpy/mutpy/utils.py", line 247, in __call__
    result = self.method(*args, **kwargs)
  File "/Users/boxed/Projects/mutpy/mutpy/controller.py", line 133, in create_target_ast
    return utils.create_ast(target_file.read())
  File "/Users/boxed/Projects/tri.struct/venv/bin/../lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xca in position 0: invalid continuation byte

I modified the code to print the filename it's trying to read and it's /Users/boxed/Projects/tri.struct/lib/tri/struct/_cstruct.cpython-36m-darwin.so, so that seems pretty wrong. I guess mutpy should only try .py files.

@boxed
Copy link
Author

boxed commented Nov 18, 2018

I worked around this by temporarily deleting the cython part of the code base and then it runs. Although 33 mutants seem awfully low hm...

@phihos
Copy link
Collaborator

phihos commented Nov 22, 2018

I updated the branch to the current master and I implemented a fix that skips C extensions when mutating modules. Can you verify that it works now?

@boxed
Copy link
Author

boxed commented Nov 23, 2018

Yea, that works better. But something is still weird because it ends up saying 100% of mutants survives. You could try this yourself, it's https://github.com/triOptima/tri.struct and the full mutpy run only takes 6 seconds.

@phihos
Copy link
Collaborator

phihos commented Nov 23, 2018

I close this issue since the original problem stated in the title is resolved now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants