Home | History | Annotate | Line # | Download | only in radix
      1      1.1  christos /*
      2      1.1  christos  * Copyright 2024-2025 The OpenSSL Project Authors. All Rights Reserved.
      3      1.1  christos  *
      4      1.1  christos  * Licensed under the Apache License 2.0 (the "License").  You may not use
      5      1.1  christos  * this file except in compliance with the License.  You can obtain a copy
      6      1.1  christos  * in the file LICENSE in the source distribution or at
      7      1.1  christos  * https://www.openssl.org/source/license.html
      8      1.1  christos  */
      9      1.1  christos 
     10      1.1  christos OPT_TEST_DECLARE_USAGE("cert_file key_file\n")
     11      1.1  christos 
     12      1.1  christos /*
     13      1.1  christos  * A RADIX test suite binding must define:
     14      1.1  christos  *
     15      1.1  christos  *   static SCRIPT_INFO *const scripts[];
     16      1.1  christos  *
     17      1.1  christos  *   int bindings_process_init(size_t node_idx, size_t process_idx);
     18      1.1  christos  *   void bindings_process_finish(int testresult);
     19      1.1  christos  *   int bindings_adjust_terp_config(TERP_CONFIG *cfg);
     20      1.1  christos  *
     21      1.1  christos  */
     22      1.1  christos static int test_script(int idx)
     23      1.1  christos {
     24      1.1  christos     SCRIPT_INFO *script_info = scripts[idx];
     25      1.1  christos     int testresult;
     26  1.1.1.2  christos     TERP_CONFIG cfg = { 0 };
     27      1.1  christos 
     28      1.1  christos     if (!TEST_true(bindings_process_init(0, 0)))
     29      1.1  christos         return 0;
     30      1.1  christos 
     31      1.1  christos     cfg.debug_bio = bio_err;
     32      1.1  christos 
     33      1.1  christos     if (!TEST_true(bindings_adjust_terp_config(&cfg)))
     34      1.1  christos         return 0;
     35      1.1  christos 
     36      1.1  christos     testresult = TERP_run(script_info, &cfg);
     37      1.1  christos 
     38      1.1  christos     if (!bindings_process_finish(testresult))
     39      1.1  christos         testresult = 0;
     40      1.1  christos 
     41      1.1  christos     return testresult;
     42      1.1  christos }
     43      1.1  christos 
     44      1.1  christos int setup_tests(void)
     45      1.1  christos {
     46      1.1  christos     if (!test_skip_common_options()) {
     47      1.1  christos         TEST_error("Error parsing test options\n");
     48      1.1  christos         return 0;
     49      1.1  christos     }
     50      1.1  christos 
     51      1.1  christos     cert_file = test_get_argument(0);
     52      1.1  christos     if (cert_file == NULL)
     53      1.1  christos         cert_file = "test/certs/servercert.pem";
     54      1.1  christos 
     55      1.1  christos     key_file = test_get_argument(1);
     56      1.1  christos     if (key_file == NULL)
     57      1.1  christos         key_file = "test/certs/serverkey.pem";
     58      1.1  christos 
     59      1.1  christos     ADD_ALL_TESTS(test_script, OSSL_NELEM(scripts));
     60      1.1  christos     return 1;
     61      1.1  christos }
     62