From 60efa8927bd439b3ec90ad5c38e6fb99ee6a8757 Mon Sep 17 00:00:00 2001 From: Seth Grover Date: Mon, 4 Nov 2024 10:03:10 -0700 Subject: [PATCH] work in progress --- src/maltest/maltest.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/maltest/maltest.py b/src/maltest/maltest.py index 9ab58c4..06559bd 100755 --- a/src/maltest/maltest.py +++ b/src/maltest/maltest.py @@ -35,6 +35,8 @@ def shutdown_handler(signum, frame): ################################################################################################### # main def main(): + global ShuttingDown + parser = argparse.ArgumentParser( description='\n'.join( [ @@ -330,20 +332,22 @@ def main(): # TODO: Assuming the Malcolm directory like this might not be very robust pcapFileParts = os.path.splitext(pcapFile) if pcapHash := shakey_file_hash(pcapFile): - copyCode = malcolmVm.CopyFile( - pcapFile, - f'/home/{args.vmImageUsername}/Malcolm/pcap/upload/{pcapHash}{pcapFileParts[1]}', - tolerateFailure=True, - ) - if copyCode == 0: - set_pcap_hash(pcapFile, pcapHash) + if ShuttingDown[0] == False: + copyCode = malcolmVm.CopyFile( + pcapFile, + f'/home/{args.vmImageUsername}/Malcolm/pcap/upload/{pcapHash}{pcapFileParts[1]}', + tolerateFailure=True, + ) + if copyCode == 0: + set_pcap_hash(pcapFile, pcapHash) # wait for all logs to finish being ingested into the system if not malcolmVm.WaitForLastEventTime(): logging.warning(f"Malcolm instance never achieved idle state after inserting events") # run the tests - exitCode = pytest.main(list(mmguero.Flatten(['-p', 'no:cacheprovider', args.testPath, extraArgs]))) + if ShuttingDown[0] == False: + exitCode = pytest.main(list(mmguero.Flatten(['-p', 'no:cacheprovider', args.testPath, extraArgs]))) # if we started Malcolm, sleep until instructed if args.startMalcolm: