Skip to content

Commit

Permalink
tests: handle any cmake detected python interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
moneromooo-monero committed Mar 7, 2019
1 parent 5bbbe39 commit fa43b54
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/block_weight/CMakeLists.txt
Expand Up @@ -42,4 +42,4 @@ target_link_libraries(block_weight

add_test(
NAME block_weight
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/compare.py ${CMAKE_CURRENT_SOURCE_DIR}/block_weight.py ${CMAKE_CURRENT_BINARY_DIR}/block_weight)
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/compare.py ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/block_weight.py ${CMAKE_CURRENT_BINARY_DIR}/block_weight)
2 changes: 1 addition & 1 deletion tests/block_weight/block_weight.py
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# Simulate a maximal block attack on the Monero network
# This uses the scheme proposed by ArticMine
# Written by Sarang Nother
Expand Down
15 changes: 11 additions & 4 deletions tests/block_weight/compare.py
Expand Up @@ -3,10 +3,17 @@
import sys
import subprocess

print 'running: ', sys.argv[1]
S0 = subprocess.check_output(sys.argv[1], stderr=subprocess.STDOUT)
print 'running: ', sys.argv[2]
S1 = subprocess.check_output(sys.argv[2], stderr=subprocess.STDOUT)
if len(sys.argv) == 4:
first = [sys.argv[1], sys.argv[2]]
second = [sys.argv[3]]
else:
first = [sys.argv[1]]
second = [sys.argv[2]]

print 'running: ', first
S0 = subprocess.check_output(first, stderr=subprocess.STDOUT)
print 'running: ', second
S1 = subprocess.check_output(second, stderr=subprocess.STDOUT)
print 'comparing'
if S0 != S1:
sys.exit(1)
Expand Down

0 comments on commit fa43b54

Please sign in to comment.