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

PTL supports running tests multiple times #1908

Merged
merged 2 commits into from Jul 20, 2020

Conversation

birbalsain
Copy link
Contributor

@birbalsain birbalsain commented Jul 17, 2020

Describe Bug or Feature

Test Framework should allow testers to run a test for multiple times. Tester can use delay between two repetition.

Describe Your Change

Introduces new pbs_benchpress options --repeat_tests= for how many times test will run and
--repeat_tests_delay for delay= delay between repeated test.

Each repetition includes all submitted tests. next repetition starts after finishing of all tests of first repetition.
If submits three tests then in first repetition all three tests run and after finishing all three tests, next repetition starts and again all three tests run.

At the end we get message " All tests are repeated times"

Link to Design Doc

https://pbspro.atlassian.net/wiki/spaces/PD/pages/1386938446/Test+Framework+should+allow+testers+to+run+a+test+for+multiple+times

Attach Test and Valgrind Logs/Output

repetition_mixed_testsuite.txt
repetition_multiple_tests.txt
no_repetition.txt
json_report.txt

@@ -145,6 +145,8 @@ def usage():
'fails\n']
msg += ['--timeout=<seconds>: duration after which no test suites are '
'run\n']
msg += ['--repeat-tests=<int>: number of times test is going to repeat\n']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about --repeat-count=<count>: repeat given all tests <count> times\n?

@@ -145,6 +145,8 @@ def usage():
'fails\n']
msg += ['--timeout=<seconds>: duration after which no test suites are '
'run\n']
msg += ['--repeat-tests=<int>: number of times test is going to repeat\n']
msg += ['--repeat-tests-delay=<seconds>: delay between two repetition\n']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think --repeat-delay will be a better name

test(result)
for i in range(self.repetition):
self.logger.info("====================================")
self.logger.info("tests are running (" + str(i + 1) + ") time")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.logger.info("Running tests %d time" % i + 1)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need both this message and the below one. We only need to be told once that the tests were repeated N times.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @bhroam.

self.logger.info("====================================")
self.logger.info("tests are running (" + str(i + 1) + ") time")
self.logger.info("====================================")
if i is not 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest not to use is not (py3.8 gives a warning for it), also you can do if i != 0: here

time.sleep(self.repetition_delay)
test(result)
self.logger.info("=============================================")
self.logger.info(" All tests are repeated " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.logger.info("All Tests are repeated %d times" % self.repeat_count)

Also shouldn't we print this message only if repeat count is > 0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually repeat_count = 1 by default, so it should be > 1.

self.logger = logging.getLogger(__name__)
self.result = None
self.repetition = repetition
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about repeat_count as a variable name? and for below repeat_delay

@hirenvadalia
Copy link
Contributor

Also, PR title and commit-msg can better like Add support for running tests multiple time in PTL

@birbalsain birbalsain changed the title Tests run multiple times PTL supports running tests multiple times Jul 20, 2020
@birbalsain
Copy link
Contributor Author

Thanks @hirenvadalia @bhroam , I have done the changes.

Copy link
Contributor

@bhroam bhroam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bhroam bhroam merged commit 5a2ec6f into openpbs:master Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants