MozillaSecurity / lithium

Line-based testcase reducer
Mozilla Public License 2.0
94 stars 25 forks source link

How does one use a built-in interestingness test? #76

Closed edmcman closed 5 years ago

edmcman commented 5 years ago

I'm having trouble using a built-in interestingness test crashes.py. What am I doing wrong?

[eschwartz@pd2 lithium]$ python -m lithium ~/.local/lib/python2.7/site-packages/lithium/interestingness/crashes.py
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/data/shared/home/eschwartz/.local/lib/python2.7/site-packages/lithium/__main__.py", line 13, in <module>
    main()
  File "/home/eschwartz/.local/lib/python2.7/site-packages/lithium/reducer.py", line 1517, in main
    exit(Lithium().main())
  File "/home/eschwartz/.local/lib/python2.7/site-packages/lithium/reducer.py", line 1293, in main
    self.processArgs(args)
  File "/home/eschwartz/.local/lib/python2.7/site-packages/lithium/reducer.py", line 1437, in processArgs
    self.conditionScript = rel_or_abs_import(extra_args[0])
  File "/home/eschwartz/.local/lib/python2.7/site-packages/lithium/interestingness/utils.py", line 140, in rel_or_abs_import
    return importlib.import_module(module)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/data/shared/home/eschwartz/.local/lib/python2.7/site-packages/lithium/interestingness/crashes.py", line 18, in <module>
    from . import timed_run
ValueError: Attempted relative import in non-package
jschwartzentruber commented 5 years ago

Just use the basename: python -m lithium crashes program testcase

edmcman commented 5 years ago

Doh. Thanks. I tried python -m lithium crashes and it complained, so I thought that didn't work.

jschwartzentruber commented 5 years ago

Yes. The error message is not helpful, because it uses the last arg as the testcase, even if you haven't given enough args. :(

Btw I think you should still be able to use your own interestingness script the way you tried. The only reason the built-in ones don't work that way is because of the relative imports.