Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling end of continous burst mode properly with a SIGTERM signal #7

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions trex-container-app/app/scripts/run-trex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 12 additions & 3 deletions trex-container-app/app/scripts/run-trex-direct
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down