adding unit test for vx_malloc

This commit is contained in:
Blaise Tine
2022-01-30 05:57:18 -05:00
parent 3750c672a7
commit e3e2609f7e
8 changed files with 298 additions and 168 deletions

View File

@@ -4,19 +4,22 @@ import time
import threading
import subprocess
PingInterval = 15
# This script executes a long-running command while outputing "still running ..." periodically
# to notify Travis build system that the program has not hanged
def PingCallback(stop):
PING_INTERVAL=15
def monitor(stop):
wait_time = 0
while True:
time.sleep(PingInterval)
wait_time += PingInterval
time.sleep(PING_INTERVAL)
wait_time += PING_INTERVAL
print(" + still running (" + str(wait_time) + "s) ...")
sys.stdout.flush()
if stop():
break
def run_command(command):
def execute(command):
process = subprocess.Popen(command, stdout=subprocess.PIPE)
while True:
output = process.stdout.readline()
@@ -24,18 +27,23 @@ def run_command(command):
break
if output:
print output.strip()
sys.stdout.flush()
return process.returncode
def main(argv):
stop_threads = False
t = threading.Thread(target = PingCallback, args =(lambda : stop_threads, ))
# start monitoring thread
stop_monitor = False
t = threading.Thread(target = monitor, args =(lambda : stop_monitor, ))
t.start()
exitcode = run_command(argv)
# execute command
exitcode = execute(argv)
print(" + exitcode="+str(exitcode))
stop_threads = True
sys.stdout.flush()
# terminate monitoring thread
stop_monitor = True
t.join()
sys.exit(exitcode)