#151 Tests fail due to python mismatch

Closed
opened 6 years ago by leon.boeck · 4 comments

When running the tests on Ubuntu 18.04 I get the following error: (happens for 19 our of 85 tests)

$ ./run_tests 
Traceback (most recent call last):
  File "/home/xtikka/workspaces/id2t/code/CLI.py", line 5, in <module>
    from Core.Controller import Controller
  File "/home/xtikka/workspaces/id2t/code/Core/Controller.py", line 9, in <module>
    import Core.AttackController as atkCtrl
  File "/home/xtikka/workspaces/id2t/code/Core/AttackController.py", line 9, in <module>
    import Core.Statistics as Statistics
  File "/home/xtikka/workspaces/id2t/code/Core/Statistics.py", line 10, in <module>
    import ID2TLib.libpcapreader as pr
ImportError: Python version mismatch: module was compiled for version 3.7, while the interpreter is running version 3.6.
EEEEEEEEEEEEE..........EEEEE...................................................E.....
======================================================================
ERROR: test_AttackController (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_AttackController
Traceback (most recent call last):
  File "/usr/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/home/xtikka/workspaces/id2t/code/Test/test_AttackController.py", line 3, in <module>
    import Core.AttackController as atkCtrl
  File "/home/xtikka/workspaces/id2t/code/Core/AttackController.py", line 9, in <module>
    import Core.Statistics as Statistics
  File "/home/xtikka/workspaces/id2t/code/Core/Statistics.py", line 10, in <module>
    import ID2TLib.libpcapreader as pr
ImportError: Python version mismatch: module was compiled for version 3.7, while the interpreter is running version 3.6.

[EDIT: formatting]

When running the tests on Ubuntu 18.04 I get the following error: (happens for 19 our of 85 tests) $ ./run_tests Traceback (most recent call last): File "/home/xtikka/workspaces/id2t/code/CLI.py", line 5, in <module> from Core.Controller import Controller File "/home/xtikka/workspaces/id2t/code/Core/Controller.py", line 9, in <module> import Core.AttackController as atkCtrl File "/home/xtikka/workspaces/id2t/code/Core/AttackController.py", line 9, in <module> import Core.Statistics as Statistics File "/home/xtikka/workspaces/id2t/code/Core/Statistics.py", line 10, in <module> import ID2TLib.libpcapreader as pr ImportError: Python version mismatch: module was compiled for version 3.7, while the interpreter is running version 3.6. EEEEEEEEEEEEE..........EEEEE...................................................E..... ====================================================================== ERROR: test_AttackController (unittest.loader._FailedTest) ---------------------------------------------------------------------- ImportError: Failed to import test module: test_AttackController Traceback (most recent call last): File "/usr/lib/python3.6/unittest/loader.py", line 428, in _find_test_path module = self._get_module_from_name(name) File "/usr/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name __import__(name) File "/home/xtikka/workspaces/id2t/code/Test/test_AttackController.py", line 3, in <module> import Core.AttackController as atkCtrl File "/home/xtikka/workspaces/id2t/code/Core/AttackController.py", line 9, in <module> import Core.Statistics as Statistics File "/home/xtikka/workspaces/id2t/code/Core/Statistics.py", line 10, in <module> import ID2TLib.libpcapreader as pr ImportError: Python version mismatch: module was compiled for version 3.7, while the interpreter is running version 3.6. [EDIT: formatting]
Jens Keim commented 6 years ago
Collaborator

I'll look into it.

I'll look into it.
Jens Keim commented 6 years ago
Collaborator

I'm not able to reproduce this errors on a fresh install of Ubuntu 18.04.

Did you try a full rebuild?

./build.sh --full

When updating dependencies, please make sure to always build again.

There are some smaller test failures though. I'll look into them.

$ ./run_tests 
.....................................................................................................................................................................F......................................................................F............FF.................
======================================================================
FAIL: test_smbscan_smb2 (test_SMBScanAttack.UnitTestSMBScan)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pepper-jk/code/ID2T-toolkit/code/Test/test_SMBScanAttack.py", line 64, in test_smbscan_smb2
    'hosting.ip=192.168.178.5', 'protocol.version=2.1', 'hosting.version=2.1']], sha_smb2)
  File "/home/pepper-jk/code/ID2T-toolkit/code/Test/ID2TAttackTest.py", line 42, in checksum_test
    self.assertEqual(sha256_checksum, Lib.get_sha256(controller.pcap_dest_path))
AssertionError: 'ef525fb61612a3db90bd0bbfaf4412f682933954357c941e1d8ac05c9ec373d4' != '87c5178042f3ef37a9385e45e7cc96afb3aa3ea0050fa0acb57d1de54517affa'
- ef525fb61612a3db90bd0bbfaf4412f682933954357c941e1d8ac05c9ec373d4
+ 87c5178042f3ef37a9385e45e7cc96afb3aa3ea0050fa0acb57d1de54517affa


======================================================================
FAIL: test_get_file_information (test_internalQueries.UnitTestInternalQueries)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pepper-jk/code/ID2T-toolkit/code/Test/test_internalQueries.py", line 28, in test_get_file_information
    ('Capture end', '\t1970-01-01 01:08:10.102034')])
AssertionError: Lists differ: [('Pc[349 chars], '1969-12-31 16:07:39.604899'), ('Capture dur[134 chars]34')] != [('Pc[349 chars], '1970-01-01 01:07:39.604899'), ('Capture dur[134 chars]34')]

First differing element 6:
('Last unknown PDU', '1969-12-31 16:07:39.604899')
('Last unknown PDU', '1970-01-01 01:07:39.604899')

Diff is 963 characters long. Set self.maxDiff to None to see it.

======================================================================
FAIL: test_get_pcap_timestamp_end (test_internalQueries.UnitTestInternalQueries)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pepper-jk/code/ID2T-toolkit/code/Test/test_internalQueries.py", line 40, in test_get_pcap_timestamp_end
    self.assertEqual(controller.statistics.get_pcap_timestamp_end(), '1970-01-01 01:08:10.102034')
AssertionError: '1969-12-31 16:08:10.102034' != '1970-01-01 01:08:10.102034'
- 1969-12-31 16:08:10.102034
?   ^^  - ^   -
+ 1970-01-01 01:08:10.102034
?   ^^ +  ^  +


======================================================================
FAIL: test_get_pcap_timestamp_start (test_internalQueries.UnitTestInternalQueries)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pepper-jk/code/ID2T-toolkit/code/Test/test_internalQueries.py", line 37, in test_get_pcap_timestamp_start
    self.assertEqual(controller.statistics.get_pcap_timestamp_start(), '1970-01-01 01:01:45.647675')
AssertionError: '1969-12-31 16:01:45.647675' != '1970-01-01 01:01:45.647675'
- 1969-12-31 16:01:45.647675
?   ^^  - ^   -
+ 1970-01-01 01:01:45.647675
?   ^^ +  ^  +


----------------------------------------------------------------------
Ran 268 tests in 107.761s

FAILED (failures=4)

There are some pip packages, which fail to install on Ubuntu 18.04:

Collecting six==1.11.0 (from -r resources/requirements.txt (line 18))
  Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in ./.venv/lib/python3.6/site-packages (from kiwisolver==1.0.1->-r resources/requirements.txt (line 5))
Building wheels for collected packages: cairocffi, lea, memory-profiler, psutil, pycparser, scapy-python3
  Running setup.py bdist_wheel for cairocffi ... error
  Complete output from command /home/pepper-jk/code/ID2T-toolkit/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bt2qny_q/cairocffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp6u25gxnnpip-wheel- --python-tag cp36:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for cairocffi
  Running setup.py clean for cairocffi
  Running setup.py bdist_wheel for lea ... error
  Complete output from command /home/pepper-jk/code/ID2T-toolkit/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bt2qny_q/lea/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpph53bqu0pip-wheel- --python-tag cp36:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for lea
  Running setup.py clean for lea
  Running setup.py bdist_wheel for memory-profiler ... error
  Complete output from command /home/pepper-jk/code/ID2T-toolkit/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bt2qny_q/memory-profiler/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpggl6fy7cpip-wheel- --python-tag cp36:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for memory-profiler
  Running setup.py clean for memory-profiler
  Running setup.py bdist_wheel for psutil ... error
  Complete output from command /home/pepper-jk/code/ID2T-toolkit/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bt2qny_q/psutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpudhmm6ofpip-wheel- --python-tag cp36:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for psutil
  Running setup.py clean for psutil
  Running setup.py bdist_wheel for pycparser ... error
  Complete output from command /home/pepper-jk/code/ID2T-toolkit/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bt2qny_q/pycparser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp3i99vlynpip-wheel- --python-tag cp36:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for pycparser
  Running setup.py clean for pycparser
  Running setup.py bdist_wheel for scapy-python3 ... error
  Complete output from command /home/pepper-jk/code/ID2T-toolkit/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bt2qny_q/scapy-python3/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpfdfkuw96pip-wheel- --python-tag cp36:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for scapy-python3
  Running setup.py clean for scapy-python3
Failed to build cairocffi lea memory-profiler psutil pycparser scapy-python3
I'm not able to reproduce this errors on a fresh install of Ubuntu 18.04. Did you try a full rebuild? ./build.sh --full When updating dependencies, please make sure to always build again. There are some smaller test failures though. I'll look into them. $ ./run_tests .....................................................................................................................................................................F......................................................................F............FF................. ====================================================================== FAIL: test_smbscan_smb2 (test_SMBScanAttack.UnitTestSMBScan) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pepper-jk/code/ID2T-toolkit/code/Test/test_SMBScanAttack.py", line 64, in test_smbscan_smb2 'hosting.ip=192.168.178.5', 'protocol.version=2.1', 'hosting.version=2.1']], sha_smb2) File "/home/pepper-jk/code/ID2T-toolkit/code/Test/ID2TAttackTest.py", line 42, in checksum_test self.assertEqual(sha256_checksum, Lib.get_sha256(controller.pcap_dest_path)) AssertionError: 'ef525fb61612a3db90bd0bbfaf4412f682933954357c941e1d8ac05c9ec373d4' != '87c5178042f3ef37a9385e45e7cc96afb3aa3ea0050fa0acb57d1de54517affa' - ef525fb61612a3db90bd0bbfaf4412f682933954357c941e1d8ac05c9ec373d4 + 87c5178042f3ef37a9385e45e7cc96afb3aa3ea0050fa0acb57d1de54517affa ====================================================================== FAIL: test_get_file_information (test_internalQueries.UnitTestInternalQueries) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pepper-jk/code/ID2T-toolkit/code/Test/test_internalQueries.py", line 28, in test_get_file_information ('Capture end', '\t1970-01-01 01:08:10.102034')]) AssertionError: Lists differ: [('Pc[349 chars], '1969-12-31 16:07:39.604899'), ('Capture dur[134 chars]34')] != [('Pc[349 chars], '1970-01-01 01:07:39.604899'), ('Capture dur[134 chars]34')] First differing element 6: ('Last unknown PDU', '1969-12-31 16:07:39.604899') ('Last unknown PDU', '1970-01-01 01:07:39.604899') Diff is 963 characters long. Set self.maxDiff to None to see it. ====================================================================== FAIL: test_get_pcap_timestamp_end (test_internalQueries.UnitTestInternalQueries) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pepper-jk/code/ID2T-toolkit/code/Test/test_internalQueries.py", line 40, in test_get_pcap_timestamp_end self.assertEqual(controller.statistics.get_pcap_timestamp_end(), '1970-01-01 01:08:10.102034') AssertionError: '1969-12-31 16:08:10.102034' != '1970-01-01 01:08:10.102034' - 1969-12-31 16:08:10.102034 ? ^^ - ^ - + 1970-01-01 01:08:10.102034 ? ^^ + ^ + ====================================================================== FAIL: test_get_pcap_timestamp_start (test_internalQueries.UnitTestInternalQueries) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pepper-jk/code/ID2T-toolkit/code/Test/test_internalQueries.py", line 37, in test_get_pcap_timestamp_start self.assertEqual(controller.statistics.get_pcap_timestamp_start(), '1970-01-01 01:01:45.647675') AssertionError: '1969-12-31 16:01:45.647675' != '1970-01-01 01:01:45.647675' - 1969-12-31 16:01:45.647675 ? ^^ - ^ - + 1970-01-01 01:01:45.647675 ? ^^ + ^ + ---------------------------------------------------------------------- Ran 268 tests in 107.761s FAILED (failures=4) There are some pip packages, which fail to install on Ubuntu 18.04: Collecting six==1.11.0 (from -r resources/requirements.txt (line 18)) Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl Requirement already satisfied: setuptools in ./.venv/lib/python3.6/site-packages (from kiwisolver==1.0.1->-r resources/requirements.txt (line 5)) Building wheels for collected packages: cairocffi, lea, memory-profiler, psutil, pycparser, scapy-python3 Running setup.py bdist_wheel for cairocffi ... error Complete output from command /home/pepper-jk/code/ID2T-toolkit/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bt2qny_q/cairocffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp6u25gxnnpip-wheel- --python-tag cp36: usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: -c --help [cmd1 cmd2 ...] or: -c --help-commands or: -c cmd --help error: invalid command 'bdist_wheel' ---------------------------------------- Failed building wheel for cairocffi Running setup.py clean for cairocffi Running setup.py bdist_wheel for lea ... error Complete output from command /home/pepper-jk/code/ID2T-toolkit/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bt2qny_q/lea/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpph53bqu0pip-wheel- --python-tag cp36: usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: -c --help [cmd1 cmd2 ...] or: -c --help-commands or: -c cmd --help error: invalid command 'bdist_wheel' ---------------------------------------- Failed building wheel for lea Running setup.py clean for lea Running setup.py bdist_wheel for memory-profiler ... error Complete output from command /home/pepper-jk/code/ID2T-toolkit/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bt2qny_q/memory-profiler/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpggl6fy7cpip-wheel- --python-tag cp36: usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: -c --help [cmd1 cmd2 ...] or: -c --help-commands or: -c cmd --help error: invalid command 'bdist_wheel' ---------------------------------------- Failed building wheel for memory-profiler Running setup.py clean for memory-profiler Running setup.py bdist_wheel for psutil ... error Complete output from command /home/pepper-jk/code/ID2T-toolkit/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bt2qny_q/psutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpudhmm6ofpip-wheel- --python-tag cp36: usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: -c --help [cmd1 cmd2 ...] or: -c --help-commands or: -c cmd --help error: invalid command 'bdist_wheel' ---------------------------------------- Failed building wheel for psutil Running setup.py clean for psutil Running setup.py bdist_wheel for pycparser ... error Complete output from command /home/pepper-jk/code/ID2T-toolkit/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bt2qny_q/pycparser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp3i99vlynpip-wheel- --python-tag cp36: usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: -c --help [cmd1 cmd2 ...] or: -c --help-commands or: -c cmd --help error: invalid command 'bdist_wheel' ---------------------------------------- Failed building wheel for pycparser Running setup.py clean for pycparser Running setup.py bdist_wheel for scapy-python3 ... error Complete output from command /home/pepper-jk/code/ID2T-toolkit/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bt2qny_q/scapy-python3/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpfdfkuw96pip-wheel- --python-tag cp36: usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: -c --help [cmd1 cmd2 ...] or: -c --help-commands or: -c cmd --help error: invalid command 'bdist_wheel' ---------------------------------------- Failed building wheel for scapy-python3 Running setup.py clean for scapy-python3 Failed to build cairocffi lea memory-profiler psutil pycparser scapy-python3
Jens Keim commented 6 years ago
Collaborator

My failing tests were caused be the VM having the wrong time zone. I opened another issue #152 for this, so for the future make the tests time zone independent.

The wheel issue was fixed by 1fa1233925.

I still could not reproduce your issues @leon.boeck.

My failing tests were caused be the VM having the wrong time zone. I opened another issue #152 for this, so for the future make the tests time zone independent. The wheel issue was fixed by 1fa1233925af133fa36efedc3a7b011b9658757d. I still could not reproduce your issues @leon.boeck.
Jens Keim commented 6 years ago
Collaborator

I was informed by @carlos.garcia, that a full rebuild did the trick. I'll close this issue now.

I was informed by @carlos.garcia, that a full rebuild did the trick. I'll close this issue now.
Sign in to join this conversation.
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.