[njs] Tests: introducing repeat argument for unit tests.

Dmitry Volyntsev xeioex at nginx.com
Wed Sep 29 16:14:39 UTC 2021


details:   https://hg.nginx.org/njs/rev/56e3f06da4f0
branches:  
changeset: 1709:56e3f06da4f0
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed Sep 29 16:13:36 2021 +0000
description:
Tests: introducing repeat argument for unit tests.

diffstat:

 src/test/njs_unit_test.c |  13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diffs (38 lines):

diff -r 06d4768b37d8 -r 56e3f06da4f0 src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c	Wed Sep 29 13:45:26 2021 +0000
+++ b/src/test/njs_unit_test.c	Wed Sep 29 16:13:36 2021 +0000
@@ -22797,6 +22797,7 @@ njs_get_options(njs_opts_t *opts, int ar
         "Options:\n"
         "  -d                           print disassembled code.\n"
         "  -f PATTERN1[|PATTERN2..]     filter test suites to run.\n"
+        "  -r count                     overrides repeat count for tests.\n"
         "  -v                           verbose mode.\n";
 
     for (i = 1; i < argc; i++) {
@@ -22829,6 +22830,15 @@ njs_get_options(njs_opts_t *opts, int ar
             njs_stderror("option \"-f\" requires argument\n");
             return NJS_ERROR;
 
+        case 'r':
+            if (++i < argc) {
+                opts->repeat = atoi(argv[i]);
+                break;
+            }
+
+            njs_stderror("option \"-r\" requires argument\n");
+            return NJS_ERROR;
+
         case 'v':
             opts->verbose = 1;
             break;
@@ -23033,8 +23043,9 @@ main(int argc, char **argv)
 
         op = suite->opts;
 
+        op.disassemble = opts.disassemble;
+        op.repeat = opts.repeat ? opts.repeat : op.repeat;
         op.verbose = opts.verbose;
-        op.disassemble = opts.disassemble;
 
         ret = suite->run(suite->tests, suite->n, &suite->name, &op, &stat);
         if (ret != NJS_OK) {


More information about the nginx-devel mailing list