• Brenden Blanco's avatar
    python3 fixes and testing support (#1916) · a296e1e3
    Brenden Blanco authored
    * python3: check ksymname calls with _assert_is_bytes
    
    Fixes a bytes/string concatenation error when get/fix_syscall_fnname is
    called from a python3 system.
    
    * python3: use env python invocation in tools
    
    In order to facilitate testing, but not necessarily as an example of
    good practice, I am changing the invocation of the test tools to use
    `/usr/bin/env python`, so that we can control which python (2 vs 3)
    gets invoked for the test. On the buildbots, I plan to add an optional
    `ln -s /usr/bin/python3 /usr/local/bin/python` on systems that have
    python3-bcc package built. This way, we get more test coverage. Having a
    cmake mechanism to enable both python2 and python3 testing could be a
    further enhancement.
    
    * tools/memleak: add an explicit stdout.flush to print loop
    
    The stdout flush behavior seems to have changed in python3, breaking one
    of the tests. I think it makes sense to flush stdout at the end of each
    timed interval loop anyway, so adding that to the tool itself.
    
    * tests: add b'' strings and fix dangling handles
    
    Add b'' strings in a few places in the test tools, and fix one dangling
    process handle in the memleak test tool runner.
    a296e1e3
test_utils.py 697 Bytes