In python3, output needs to be converted from ascii to str before the
"error_msg in str" test will succeed. This change should be backwards
compatible with python2.
Signed-off-by: Brenden Blanco <bblanco@gmail.com>
add_test(NAME py_test_stat1_b WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${TEST_WRAPPER} py_stat1_b namespace ${CMAKE_CURRENT_SOURCE_DIR}/test_stat1.py test_stat1.b proto.b)
add_test(NAME py_test_bpf_log WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMAND ${TEST_WRAPPER} py_bpf_prog namespace ${CMAKE_CURRENT_SOURCE_DIR}/test_bpf_log.py)
+ COMMAND ${TEST_WRAPPER} py_bpf_prog sudo ${CMAKE_CURRENT_SOURCE_DIR}/test_bpf_log.py)
add_test(NAME py_test_stat1_c WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${TEST_WRAPPER} py_stat1_c namespace ${CMAKE_CURRENT_SOURCE_DIR}/test_stat1.py test_stat1.c)
#add_test(NAME py_test_xlate1_b WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
except Exception:
self.fp.flush()
self.fp.seek(0)
- self.assertEqual(error_msg in self.fp.read(), True)
+ self.assertEqual(error_msg in self.fp.read().decode(), True)
def test_log_no_debug(self):
except Exception:
self.fp.flush()
self.fp.seek(0)
- self.assertEqual(error_msg in self.fp.read(), True)
+ self.assertEqual(error_msg in self.fp.read().decode(), True)
if __name__ == "__main__":