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