diff --git a/trex-container-app/app/scripts/run-trex b/trex-container-app/app/scripts/run-trex index 32df54b4..8f4a5a40 100755 --- a/trex-container-app/app/scripts/run-trex +++ b/trex-container-app/app/scripts/run-trex @@ -113,10 +113,18 @@ class STLS1_Wrapper(object): def signal_handler(self, sig, frame): log.info('You pressed Ctrl+C!') trexstats.force_exit = True - self.client.reset(ports = self.ports) - self.force_exit = True - clog.force_exit = True - + try: + if self.duration == -1: + stats = self.client.get_stats() + warnings = self.client.get_warnings() + passed = trexstats.completed_stats(stats, warnings, self.port_a, self.port_b, self.profile, self.rate, self.duration) + except STLError as e: + passed = False + log.info(e) + finally: + self.client.reset(ports = self.ports) + self.force_exit = True + clog.force_exit = True def main(): # run the tests diff --git a/trex-container-app/app/scripts/run-trex-direct b/trex-container-app/app/scripts/run-trex-direct index b98d900b..3d16c2ff 100755 --- a/trex-container-app/app/scripts/run-trex-direct +++ b/trex-container-app/app/scripts/run-trex-direct @@ -204,9 +204,18 @@ class STLS1(object): def signal_handler(self, sig, frame): log.info('You pressed Ctrl+C!') time.sleep(6) - self.force_exit = True - clog.force_exit = True - sys.exit(0) + try: + if self.duration == -1: + stats = self.client.get_stats() + warnings = self.client.get_warnings() + passed = trexstats.completed_stats(stats, warnings, self.port_a, self.port_b, self.profile, self.rate, self.duration) + except STLError as e: + passed = False + log.info(e) + finally: + self.force_exit = True + clog.force_exit = True + sys.exit(0) def main():