[njs] Tests: fixed benchmark after 57ca02d7404c.

Dmitry Volyntsev xeioex at nginx.com
Sat Jul 1 00:03:51 UTC 2023


details:   https://hg.nginx.org/njs/rev/494796d6d7f8
branches:  
changeset: 2171:494796d6d7f8
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Fri Jun 30 17:03:11 2023 -0700
description:
Tests: fixed benchmark after 57ca02d7404c.

diffstat:

 src/test/njs_benchmark.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r e85aaeaa7e55 -r 494796d6d7f8 src/test/njs_benchmark.c
--- a/src/test/njs_benchmark.c	Fri Jun 30 06:38:36 2023 -0700
+++ b/src/test/njs_benchmark.c	Fri Jun 30 17:03:11 2023 -0700
@@ -29,6 +29,12 @@ typedef struct {
 } njs_opts_t;
 
 
+njs_module_t *njs_benchmark_addon_external_modules[] = {
+    &njs_unit_test_external_module,
+    NULL,
+};
+
+
 static njs_int_t
 njs_benchmark_test(njs_vm_t *parent, njs_opts_t *opts, njs_value_t *report,
     njs_benchmark_test_t *test)
@@ -36,7 +42,7 @@ njs_benchmark_test(njs_vm_t *parent, njs
     u_char        *start;
     njs_vm_t      *vm, *nvm;
     uint64_t      ns;
-    njs_int_t     ret, proto_id;
+    njs_int_t     ret;
     njs_str_t     s, *expected;
     njs_uint_t    i, n;
     njs_bool_t    success;
@@ -49,6 +55,8 @@ njs_benchmark_test(njs_vm_t *parent, njs
 
     njs_vm_opt_init(&options);
 
+    options.addons = njs_benchmark_addon_external_modules;
+
     vm = NULL;
     nvm = NULL;
     ret = NJS_ERROR;
@@ -67,11 +75,6 @@ njs_benchmark_test(njs_vm_t *parent, njs
         goto done;
     }
 
-    proto_id = njs_externals_shared_init(vm);
-    if (proto_id < 0) {
-        goto done;
-    }
-
     n = test->repeat;
     expected = &test->result;
 


More information about the nginx-devel mailing list