diff mbox series

[7/8] rt-tests: deadline_test: Exit with message if threads less than 1

Message ID 20210827220244.24210-8-jkacur@redhat.com
State New
Headers show
Series [1/8] rt-tests: deadline_test: Move va_start forward | expand

Commit Message

John Kacur Aug. 27, 2021, 10:02 p.m. UTC
If the user tries to run deadline_test with threads less than  1 (zero
for example), then exit with an error message.

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 src/sched_deadline/deadline_test.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
index 1763c71486a9..53abd4d2ca6b 100644
--- a/src/sched_deadline/deadline_test.c
+++ b/src/sched_deadline/deadline_test.c
@@ -1817,6 +1817,11 @@  int main(int argc, char **argv)
 		exit(-1);
 	}
 
+	if (nr_threads < 1) {
+		fprintf(stderr, "The number of threads must be at least 1\n");
+		exit(-1);
+	}
+
 	if (setcpu) {
 		nr_cpus = calc_nr_cpus(setcpu, &setcpu_buf);
 		if (nr_cpus < 0) {