From 01b68f4059a75248738d2e1143bc410f1f7dae1c Mon Sep 17 00:00:00 2001
From: huitema <huitema@huitema.net>
Date: Sat, 8 Dec 2018 20:54:27 -0800
Subject: [PATCH] Allow running of program from a variety of locations

---
 picoquic/util.c                      |  50 ++++++
 picoquic/util.h                      |   2 +
 picoquic_t/picoquic_t.c              |  16 +-
 picoquicfirst/picoquicdemo.c         |  45 +++--
 picoquictest/cleartext_aead_test.c   | 112 ++++++++-----
 picoquictest/parseheadertest.c       |  37 ++++-
 picoquictest/picoquictest.h          |   3 +
 picoquictest/picoquictest_internal.h |  26 ++-
 picoquictest/skip_frame_test.c       |  19 ++-
 picoquictest/stresstest.c            |  69 +++++---
 picoquictest/tls_api_test.c          | 237 +++++++++++++++++++++------
 picoquictest/transport_param_test.c  |  66 +++++---
 12 files changed, 503 insertions(+), 179 deletions(-)

diff --git a/picoquic/util.c b/picoquic/util.c
index a13fa962..18379887 100644
--- a/picoquic/util.c
+++ b/picoquic/util.c
@@ -306,4 +306,54 @@ int picoquic_store_addr(struct sockaddr_storage * stored_addr, const struct sock
     }
 
     return len;
+}
+
+/* Return a directory path based on solution dir and file name */
+#ifdef _WINDOWS
+#define PICOQUIC_FILE_SEPARATOR '\\'
+#ifdef _WINDOWS64
+#define PICOQUIC_DEFAULT_SOLUTION_DIR "..\\..\\"
+#else
+#define PICOQUIC_DEFAULT_SOLUTION_DIR "..\\"
+#endif
+#else
+#define PICOQUIC_DEFAULT_SOLUTION_DIR "./"
+#define PICOQUIC_FILE_SEPARATOR '/'
+#endif
+
+int picoquic_get_input_path(char * target_file_path, size_t file_path_max, const char * solution_path, const char * file_name) 
+{
+    int ret = 0;
+    size_t solution_path_length;
+    size_t file_name_length;
+    size_t separator_length = 0;
+    if (solution_path == NULL) {
+        solution_path = PICOQUIC_DEFAULT_SOLUTION_DIR;
+    }
+
+    solution_path_length = strlen(solution_path);
+    file_name_length = strlen(file_name);
+    if (solution_path_length == 0 || solution_path[solution_path_length - 1] != PICOQUIC_FILE_SEPARATOR) {
+        separator_length = 1;
+    }
+
+    if (solution_path_length + separator_length + file_name_length + 1 > file_path_max) {
+        target_file_path[0] = 0;
+        ret = -1;
+    }
+    else {
+        size_t byte_index = 0;
+        memcpy(&target_file_path[byte_index], solution_path, solution_path_length);
+        byte_index += solution_path_length;
+
+        if (separator_length) {
+            target_file_path[byte_index++] = PICOQUIC_FILE_SEPARATOR;
+        }
+        memcpy(&target_file_path[byte_index], file_name, file_name_length);
+        byte_index += file_name_length;
+
+        target_file_path[byte_index] = 0;
+    }
+
+    return ret;
 }
\ No newline at end of file
diff --git a/picoquic/util.h b/picoquic/util.h
index 3950a29e..da3f8a5b 100644
--- a/picoquic/util.h
+++ b/picoquic/util.h
@@ -60,6 +60,8 @@ void picoquic_parse_packet_header_cnxid_lengths(uint8_t l_byte, uint8_t *dest_le
 int picoquic_compare_addr(const struct sockaddr * expected, const struct sockaddr * actual);
 int picoquic_store_addr(struct sockaddr_storage * stored_addr, const struct sockaddr * addr);
 
+int picoquic_get_input_path(char * target_file_path, size_t file_path_max, const char * solution_path, const char * file_name);
+
 #ifndef MAX
 #define MAX(a, b) ((a) > (b) ? (a) : (b))
 #endif
diff --git a/picoquic_t/picoquic_t.c b/picoquic_t/picoquic_t.c
index 003de0d0..602ad066 100644
--- a/picoquic_t/picoquic_t.c
+++ b/picoquic_t/picoquic_t.c
@@ -191,11 +191,12 @@ int usage(char const * argv0)
         fprintf(stderr, "\n");
     }
     fprintf(stderr, "Options: \n");
-    fprintf(stderr, "  -x test        Do not run the specified test.\n");
-    fprintf(stderr, "  -s nnn         Run stress for nnn minutes.\n");
-    fprintf(stderr, "  -f nnn         Run fuzz for nnn minutes.\n");
-    fprintf(stderr, "  -n             Disable debug prints.\n");
-    fprintf(stderr, "  -h             Print this help message\n");
+    fprintf(stderr, "  -x test           Do not run the specified test.\n");
+    fprintf(stderr, "  -s nnn            Run stress for nnn minutes.\n");
+    fprintf(stderr, "  -f nnn            Run fuzz for nnn minutes.\n");
+    fprintf(stderr, "  -n                Disable debug prints.\n");
+    fprintf(stderr, "  -h                Print this help message\n");
+    fprintf(stderr, "  -S solution_dir   Set the path to the source files to find the default files\n");
 
     return -1;
 }
@@ -233,7 +234,7 @@ int main(int argc, char** argv)
     }
     else
     {
-        while (ret == 0 && (opt = getopt(argc, argv, "f:s:x:nh")) != -1) {
+        while (ret == 0 && (opt = getopt(argc, argv, "f:s:S:x:nh")) != -1) {
             switch (opt) {
             case 'x': {
                 int test_number = get_test_number(optarg);
@@ -264,6 +265,9 @@ int main(int argc, char** argv)
                     ret = usage(argv[0]);
                 }
                 break;
+            case 'S':
+                picoquic_test_set_solution_dir(optarg);
+                break;
             case 'n':
                 disable_debug = 1;
                 break;
diff --git a/picoquicfirst/picoquicdemo.c b/picoquicfirst/picoquicdemo.c
index 07f5770e..93de54c1 100644
--- a/picoquicfirst/picoquicdemo.c
+++ b/picoquicfirst/picoquicdemo.c
@@ -50,13 +50,8 @@
 #define socklen_t int
 #endif
 
-#ifdef _WINDOWS64
-static const char* default_server_cert_file = "..\\..\\certs\\cert.pem";
-static const char* default_server_key_file = "..\\..\\certs\\key.pem";
-#else
-static const char* default_server_cert_file = "..\\certs\\cert.pem";
-static const char* default_server_key_file = "..\\certs\\key.pem";
-#endif
+#define SERVER_CERT_FILE "certs\\cert.pem"
+#define SERVER_KEY_FILE  "certs\\key.pem"
 
 #else /* Linux */
 
@@ -93,8 +88,8 @@ static const char* default_server_key_file = "..\\certs\\key.pem";
 #define WSA_LAST_ERROR(x) ((long)(x))
 #endif
 
-static const char* default_server_cert_file = "certs/cert.pem";
-static const char* default_server_key_file = "certs/key.pem";
+#define SERVER_KEY_FILE = "certs/cert.pem";
+#define SERVER_KEY_FILE = "certs/key.pem";
 
 #endif
 
@@ -146,11 +141,11 @@ static char* strip_endofline(char* buf, size_t bufmax, char const* line)
 
 static void picoquic_set_key_log_file_from_env(picoquic_quic_t* quic)
 {
-    const char* keylog_filename;
+    char * keylog_filename = NULL;
     FILE* F = NULL;
 
 #ifdef _WINDOWS
-    size_t len;
+    size_t len; 
     errno_t err = _dupenv_s(&keylog_filename, &len, "SSLKEYLOGFILE");
 
     if (err == 0) {
@@ -1284,7 +1279,7 @@ void usage()
     fprintf(stderr, "  For the client mode, specify sever_name and port.\n");
     fprintf(stderr, "  For the server mode, use -p to specify the port.\n");
     fprintf(stderr, "Options:\n");
-    fprintf(stderr, "  -c file               cert file (default: %s)\n", default_server_cert_file);
+    fprintf(stderr, "  -c file               cert file (default: %s)\n", SERVER_CERT_FILE);
     fprintf(stderr, "  -e if                 Send on interface (default: -1)\n");
     fprintf(stderr, "                           -1: receiving interface\n");
     fprintf(stderr, "                            0: routing lookup\n");
@@ -1299,7 +1294,7 @@ void usage()
     fprintf(stderr, "                          where <src> is int:\n");
     fprintf(stderr, "                            0: picoquic_cnx_id_random\n");
     fprintf(stderr, "                            1: picoquic_cnx_id_remote (client)\n");
-    fprintf(stderr, "  -k file               key file (default: %s)\n", default_server_key_file);
+    fprintf(stderr, "  -k file               key file (default: %s)\n", SERVER_KEY_FILE);
     fprintf(stderr, "  -l file               Log file\n");
     fprintf(stderr, "  -p port               server port (default: %d)\n", default_server_port);
     fprintf(stderr, "  -m mtu_max            Largest mtu value that can be tried for discovery\n");
@@ -1313,6 +1308,7 @@ void usage()
     fprintf(stderr, "                        or restrict the server to draft-14 mode.\n");
     fprintf(stderr, "  -z                    Set TLS zero share behavior on client, to force HRR.\n");
     fprintf(stderr, "  -1                    Once\n");
+    fprintf(stderr, "  -S solution_dir       Set the path to the source files to find the default files\n");
     exit(1);
 }
 
@@ -1344,9 +1340,10 @@ static void cnx_id_callback(picoquic_connection_id_t cnx_id_local, picoquic_conn
 
 int main(int argc, char** argv)
 {
+    const char * solution_dir = NULL;
     const char* server_name = default_server_name;
-    const char* server_cert_file = default_server_cert_file;
-    const char* server_key_file = default_server_key_file;
+    const char* server_cert_file = NULL;
+    const char* server_key_file = NULL;
     const char* log_file = NULL;
     const char * sni = NULL;
     const char * alpn = NULL;
@@ -1379,7 +1376,7 @@ int main(int argc, char** argv)
 
     /* Get the parameters */
     int opt;
-    while ((opt = getopt(argc, argv, "c:k:p:u:v:1rhzf:i:s:e:l:m:n:a:t:")) != -1) {
+    while ((opt = getopt(argc, argv, "c:k:p:u:v:1rhzf:i:s:e:l:m:n:a:t:S:")) != -1) {
         switch (opt) {
         case 'c':
             server_cert_file = optarg;
@@ -1420,6 +1417,9 @@ int main(int argc, char** argv)
             reset_seed[1] = strtoul(optarg, NULL, 0);
             reset_seed[0] = strtoul(argv[optind++], NULL, 0);
             break;
+        case 'S':
+            solution_dir = optarg;
+            break;
         case 'e':
             dest_if = atoi(optarg);
             break;
@@ -1495,6 +1495,19 @@ int main(int argc, char** argv)
 #endif
 
     if (is_client == 0) {
+        char default_server_cert_file[512];
+        char default_server_key_file[512];
+
+        if (server_cert_file == NULL &&
+            picoquic_get_input_path(default_server_cert_file, sizeof(default_server_cert_file), solution_dir, SERVER_CERT_FILE) == 0) {
+            server_cert_file = default_server_cert_file;
+        }
+
+        if (server_key_file == NULL &&
+            picoquic_get_input_path(default_server_key_file, sizeof(default_server_key_file), solution_dir, SERVER_KEY_FILE) == 0) {
+            server_key_file = default_server_cert_file;
+        }
+
         /* Run as server */
         printf("Starting PicoQUIC server on port %d, server name = %s, just_once = %d, hrr= %d\n",
             server_port, server_name, just_once, do_hrr);
diff --git a/picoquictest/cleartext_aead_test.c b/picoquictest/cleartext_aead_test.c
index 61575ee0..2bd19925 100644
--- a/picoquictest/cleartext_aead_test.c
+++ b/picoquictest/cleartext_aead_test.c
@@ -86,14 +86,37 @@ int cleartext_aead_test()
     struct sockaddr_in test_addr_c, test_addr_s;
     picoquic_cnx_t* cnx_client = NULL;
     picoquic_cnx_t* cnx_server = NULL;
-    picoquic_quic_t* qclient = picoquic_create(8, NULL, NULL, NULL, NULL, NULL, NULL,
-        NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);
-    picoquic_quic_t* qserver = picoquic_create(8,
-        PICOQUIC_TEST_SERVER_CERT, PICOQUIC_TEST_SERVER_KEY, PICOQUIC_TEST_CERT_STORE,
-        "test", NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);
-    if (qclient == NULL || qserver == NULL) {
-        DBG_PRINTF("%s", "Could not create Quic contexts.\n");
-        ret = -1;
+    picoquic_quic_t* qclient = NULL;
+    picoquic_quic_t* qserver = NULL;
+    char test_server_cert_file[512];
+    char test_server_key_file[512];
+    char test_server_cert_store_file[512];
+
+    ret = picoquic_get_input_path(test_server_cert_file, sizeof(test_server_cert_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_CERT);
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_key_file, sizeof(test_server_key_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_KEY);
+    }
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_cert_store_file, sizeof(test_server_cert_store_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_CERT_STORE);
+    }
+
+    if (ret != 0) {
+        DBG_PRINTF("%s", "Cannot set the cert, key or store file names.\n");
+    }
+    else {
+
+        qclient = picoquic_create(8, NULL, NULL, NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);
+        qserver = picoquic_create(8,
+            test_server_cert_file, test_server_key_file, test_server_cert_store_file,
+            "test", NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);
+
+        if (qclient == NULL || qserver == NULL) {
+            DBG_PRINTF("%s", "Could not create Quic contexts.\n");
+            ret = -1;
+        }
     }
 
     if (ret == 0) {
@@ -414,22 +437,29 @@ int cleartext_pn_enc_test()
     struct sockaddr_in test_addr_c, test_addr_s;
     picoquic_cnx_t* cnx_client = NULL;
     picoquic_cnx_t* cnx_server = NULL;
-    picoquic_quic_t* qclient = picoquic_create(8, NULL, NULL, NULL, NULL, NULL, NULL,
-        NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);
-    picoquic_quic_t* qserver = picoquic_create(8,
-#ifdef _WINDOWS
-#ifdef _WINDOWS64
-        "..\\..\\certs\\cert.pem", "..\\..\\certs\\key.pem",
-#else
-        "..\\certs\\cert.pem", "..\\certs\\key.pem",
-#endif
-#else
-        "certs/cert.pem", "certs/key.pem",
-#endif
-        NULL, "test", NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);
-    if (qclient == NULL || qserver == NULL) {
-        DBG_PRINTF("%s", "Could not create Quic contexts.\n");
-        ret = -1;
+    picoquic_quic_t* qclient = NULL;
+    picoquic_quic_t* qserver = NULL;
+    char test_server_cert_file[512];
+    char test_server_key_file[512];
+
+    ret = picoquic_get_input_path(test_server_cert_file, sizeof(test_server_cert_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_CERT);
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_key_file, sizeof(test_server_key_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_KEY);
+    }
+
+    if (ret != 0) {
+        DBG_PRINTF("%s", "Cannot set the cert or key file names.\n");
+    }
+    else {
+        qclient = picoquic_create(8, NULL, NULL, NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);
+        qserver = picoquic_create(8, test_server_cert_file, test_server_key_file,
+            NULL, "test", NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);
+        if (qclient == NULL || qserver == NULL) {
+            DBG_PRINTF("%s", "Could not create Quic contexts.\n");
+            ret = -1;
+        }
     }
 
     if (ret == 0) {
@@ -522,20 +552,26 @@ int cleartext_pn_vector_test()
     struct sockaddr_in test_addr_s;
     picoquic_connection_id_t initial_cnxid;
     picoquic_cnx_t* cnx_server = NULL;
-    picoquic_quic_t* qserver = picoquic_create(8,
-#ifdef _WINDOWS
-#ifdef _WINDOWS64
-        "..\\..\\certs\\cert.pem", "..\\..\\certs\\key.pem",
-#else
-        "..\\certs\\cert.pem", "..\\certs\\key.pem",
-#endif
-#else
-        "certs/cert.pem", "certs/key.pem",
-#endif
-        NULL, "test", NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);
-    if (qserver == NULL) {
-        DBG_PRINTF("%s", "Could not create Quic contexts.\n");
-        ret = -1;
+    picoquic_quic_t* qserver = NULL;
+    char test_server_cert_file[512];
+    char test_server_key_file[512];
+
+    ret = picoquic_get_input_path(test_server_cert_file, sizeof(test_server_cert_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_CERT);
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_key_file, sizeof(test_server_key_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_KEY);
+    }
+
+    if (ret != 0) {
+        DBG_PRINTF("%s", "Cannot set the cert or key file names.\n");
+    }
+    else {
+        qserver = picoquic_create(8, test_server_cert_file, test_server_key_file,
+            NULL, "test", NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);
+        if (qserver == NULL) {
+            DBG_PRINTF("%s", "Could not create Quic contexts.\n");
+            ret = -1;
+        }
     }
 
     if (ret == 0 && picoquic_parse_connection_id(cid, sizeof(cid), &initial_cnxid) != sizeof(cid)) {
diff --git a/picoquictest/parseheadertest.c b/picoquictest/parseheadertest.c
index 7cd93e01..786418ac 100644
--- a/picoquictest/parseheadertest.c
+++ b/picoquictest/parseheadertest.c
@@ -578,14 +578,35 @@ int packet_enc_dec_test()
     struct sockaddr_in test_addr_c;
     picoquic_cnx_t* cnx_client = NULL;
     picoquic_cnx_t* cnx_server = NULL;
-    picoquic_quic_t* qclient = picoquic_create(8, NULL, NULL, NULL, NULL, NULL, NULL,
-        NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);
-    picoquic_quic_t* qserver = picoquic_create(8,
-        PICOQUIC_TEST_SERVER_CERT, PICOQUIC_TEST_SERVER_KEY, PICOQUIC_TEST_CERT_STORE, 
-        "test", NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);
-    if (qclient == NULL || qserver == NULL) {
-        DBG_PRINTF("%s", "Could not create Quic contexts.\n");
-        ret = -1;
+    picoquic_quic_t* qclient = NULL;
+    picoquic_quic_t* qserver = NULL;
+    char test_server_cert_file[512];
+    char test_server_key_file[512];
+    char test_server_cert_store_file[512];
+
+    ret = picoquic_get_input_path(test_server_cert_file, sizeof(test_server_cert_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_CERT);
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_key_file, sizeof(test_server_key_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_KEY);
+    }
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_cert_store_file, sizeof(test_server_cert_store_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_CERT_STORE);
+    }
+
+    if (ret != 0) {
+        DBG_PRINTF("%s", "Cannot set the cert, key or store file names.\n");
+    }
+    else {
+        qclient = picoquic_create(8, NULL, NULL, NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);
+        qserver = picoquic_create(8,
+            test_server_cert_file, test_server_key_file, test_server_cert_store_file,
+            "test", NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);
+        if (qclient == NULL || qserver == NULL) {
+            DBG_PRINTF("%s", "Could not create Quic contexts.\n");
+            ret = -1;
+        }
     }
 
     if (ret == 0) {
diff --git a/picoquictest/picoquictest.h b/picoquictest/picoquictest.h
index e5310f37..683d7820 100644
--- a/picoquictest/picoquictest.h
+++ b/picoquictest/picoquictest.h
@@ -29,6 +29,9 @@ extern "C" {
 /* From picoquic/util.h */
 void debug_printf_suspend();
 
+/* Setting the solution dir when not executing from default location */
+void picoquic_test_set_solution_dir(char const * solution_dir);
+
 /* Control variables for the duration of the stress test */
 
 extern uint64_t picoquic_stress_test_duration; /* In microseconds; defaults to 2 minutes */
diff --git a/picoquictest/picoquictest_internal.h b/picoquictest/picoquictest_internal.h
index fd4880b6..30961682 100644
--- a/picoquictest/picoquictest_internal.h
+++ b/picoquictest/picoquictest_internal.h
@@ -35,24 +35,20 @@ extern "C" {
 #define PICOQUIC_TEST_ALPN "picoquic-test"
 
 #ifdef _WINDOWS
-#ifdef _WINDOWS64
-#define PICOQUIC_TEST_SERVER_CERT "..\\..\\certs\\cert.pem"
-#define PICOQUIC_TEST_SERVER_BAD_CERT "..\\..\\certs\\badcert.pem"
-#define PICOQUIC_TEST_SERVER_KEY "..\\..\\certs\\key.pem"
-#define PICOQUIC_TEST_CERT_STORE "..\\..\\certs\\test-ca.crt"
+#define PICOQUIC_TEST_FILE_SERVER_CERT "certs\\cert.pem"
+#define PICOQUIC_TEST_FILE_SERVER_BAD_CERT "certs\\badcert.pem"
+#define PICOQUIC_TEST_FILE_SERVER_KEY "certs\\key.pem"
+#define PICOQUIC_TEST_FILE_CERT_STORE "certs\\test-ca.crt"
 #else
-#define PICOQUIC_TEST_SERVER_CERT "..\\certs\\cert.pem"
-#define PICOQUIC_TEST_SERVER_BAD_CERT "..\\certs\\badcert.pem"
-#define PICOQUIC_TEST_SERVER_KEY "..\\certs\\key.pem"
-#define PICOQUIC_TEST_CERT_STORE "..\\certs\\test-ca.crt"
-#endif
-#else
-#define PICOQUIC_TEST_SERVER_CERT "certs/cert.pem"
-#define PICOQUIC_TEST_SERVER_BAD_CERT "certs/badcert.pem"
-#define PICOQUIC_TEST_SERVER_KEY "certs/key.pem"
-#define PICOQUIC_TEST_CERT_STORE "certs/test-ca.crt"
+#define PICOQUIC_TEST_FILE_SERVER_CERT "certs/cert.pem"
+#define PICOQUIC_TEST_FILE_SERVER_BAD_CERT "certs/badcert.pem"
+#define PICOQUIC_TEST_FILE_SERVER_KEY "certs/key.pem"
+#define PICOQUIC_TEST_FILE_CERT_STORE "certs/test-ca.crt"
 #endif
 
+ /* To set the solution directory for tests */
+extern char const * picoquic_test_solution_dir;
+
 /* Really basic network simulator, only simulates a simple link using a
  * packet structure.
  * Init: link creation. Returns a link structure with defined bandwidth,
diff --git a/picoquictest/skip_frame_test.c b/picoquictest/skip_frame_test.c
index 36501de1..384d7c1f 100644
--- a/picoquictest/skip_frame_test.c
+++ b/picoquictest/skip_frame_test.c
@@ -459,13 +459,9 @@ static char const* log_fuzz_test_file = "log_fuzz_test.txt";
 static char const* log_packet_test_file = "log_fuzz_test.txt";
 
 #ifdef _WINDOWS
-#ifndef _WINDOWS64
-static char const* log_test_ref = "..\\picoquictest\\log_test_ref.txt";
+#define LOG_TEST_REF "picoquictest\\log_test_ref.txt"
 #else
-static char const* log_test_ref = "..\\..\\picoquictest\\log_test_ref.txt";
-#endif
-#else
-static char const* log_test_ref = "picoquictest/log_test_ref.txt";
+#define LOG_TEST_REF "picoquictest/log_test_ref.txt"
 #endif
 
 static int compare_lines(char const* b1, char const* b2)
@@ -587,7 +583,16 @@ int logger_test()
     F = NULL;
 
     if (ret == 0) {
-        ret = picoquic_test_compare_files(log_test_file, log_test_ref);
+        char log_test_ref[512];
+
+        ret = picoquic_get_input_path(log_test_ref, sizeof(log_test_ref), picoquic_test_solution_dir, LOG_TEST_REF);
+
+        if (ret != 0) {
+            DBG_PRINTF("%s", "Cannot set the log ref file name.\n");
+        }
+        else {
+            ret = picoquic_test_compare_files(log_test_file, log_test_ref);
+        }
     }
 
     /* Create a set of randomized packets. Verify that they can be logged without 
diff --git a/picoquictest/stresstest.c b/picoquictest/stresstest.c
index bfbe23d9..4d48d9c4 100644
--- a/picoquictest/stresstest.c
+++ b/picoquictest/stresstest.c
@@ -23,7 +23,7 @@
 #include "tls_api.h"
 #include "picoquictest_internal.h"
 #ifdef _WINDOWS
-#include "..\picoquic\wincompat.h"
+#include "wincompat.h"
 #else
 #include <signal.h>
 #endif
@@ -844,12 +844,22 @@ static int stress_create_client_context(int client_index, picoquic_stress_ctx_t
 
     if (ret == 0) {
         /* Create the quic context for this client*/
-        ctx->qclient = picoquic_create(8, NULL, NULL, PICOQUIC_TEST_CERT_STORE, NULL, NULL,
-            NULL, NULL, NULL, NULL, stress_ctx->simulated_time, &stress_ctx->simulated_time,
-            ctx->ticket_file_name, NULL, 0);
-        if (ctx->qclient == NULL) {
-            DBG_PRINTF("Cannot create the quic client #%d.\n", (int)client_index);
-            ret = -1;
+        char test_server_cert_store_file[512];
+        if (ret == 0) {
+            ret = picoquic_get_input_path(test_server_cert_store_file, sizeof(test_server_cert_store_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_CERT_STORE);
+        }
+
+        if (ret != 0) {
+            DBG_PRINTF("%s", "Cannot set the cert store file name.\n");
+        }
+        else {
+            ctx->qclient = picoquic_create(8, NULL, NULL, test_server_cert_store_file, NULL, NULL,
+                NULL, NULL, NULL, NULL, stress_ctx->simulated_time, &stress_ctx->simulated_time,
+                ctx->ticket_file_name, NULL, 0);
+            if (ctx->qclient == NULL) {
+                DBG_PRINTF("Cannot create the quic client #%d.\n", (int)client_index);
+                ret = -1;
+            }
         }
     }
 
@@ -912,21 +922,40 @@ static int stress_or_fuzz_test(picoquic_fuzz_fn fuzz_fn, void * fuzz_ctx, uint64
             stress_ctx.nb_clients, PICOQUIC_MAX_STRESS_CLIENTS);
         ret = -1;
     } else {
-        stress_ctx.qserver = picoquic_create(PICOQUIC_MAX_STRESS_CLIENTS,
-            PICOQUIC_TEST_SERVER_CERT, PICOQUIC_TEST_SERVER_KEY, PICOQUIC_TEST_CERT_STORE,
-            PICOQUIC_TEST_ALPN, stress_server_callback, NULL, NULL, NULL, NULL,
-            stress_ctx.simulated_time, &stress_ctx.simulated_time, NULL,
-            stress_ticket_encrypt_key, sizeof(stress_ticket_encrypt_key));
-
-        if (stress_ctx.qserver == NULL) {
-            DBG_PRINTF("%s", "Cannot create the test server.\n");
-            ret = -1;
+        char test_server_cert_file[512];
+        char test_server_key_file[512];
+        char test_server_cert_store_file[512];
+
+        ret = picoquic_get_input_path(test_server_cert_file, sizeof(test_server_cert_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_CERT);
+
+        if (ret == 0) {
+            ret = picoquic_get_input_path(test_server_key_file, sizeof(test_server_key_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_KEY);
+        }
+
+        if (ret == 0) {
+            ret = picoquic_get_input_path(test_server_cert_store_file, sizeof(test_server_cert_store_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_CERT_STORE);
+        }
+
+        if (ret != 0) {
+            DBG_PRINTF("%s", "Cannot set the cert, key or store file names.\n");
         }
         else {
-            for (int i = 0; ret == 0 && i < stress_ctx.nb_clients; i++) {
-                ret = stress_create_client_context(i, &stress_ctx);
-                if (ret == 0 && fuzz_fn != NULL) {
-                    picoquic_set_fuzz(stress_ctx.c_ctx[i]->qclient, fuzz_fn, fuzz_ctx);
+            stress_ctx.qserver = picoquic_create(PICOQUIC_MAX_STRESS_CLIENTS,
+                test_server_cert_file, test_server_key_file, test_server_cert_store_file,
+                PICOQUIC_TEST_ALPN, stress_server_callback, NULL, NULL, NULL, NULL,
+                stress_ctx.simulated_time, &stress_ctx.simulated_time, NULL,
+                stress_ticket_encrypt_key, sizeof(stress_ticket_encrypt_key));
+
+            if (stress_ctx.qserver == NULL) {
+                DBG_PRINTF("%s", "Cannot create the test server.\n");
+                ret = -1;
+            }
+            else {
+                for (int i = 0; ret == 0 && i < stress_ctx.nb_clients; i++) {
+                    ret = stress_create_client_context(i, &stress_ctx);
+                    if (ret == 0 && fuzz_fn != NULL) {
+                        picoquic_set_fuzz(stress_ctx.c_ctx[i]->qclient, fuzz_fn, fuzz_ctx);
+                    }
                 }
             }
         }
diff --git a/picoquictest/tls_api_test.c b/picoquictest/tls_api_test.c
index fe862c0c..48c7ebe4 100644
--- a/picoquictest/tls_api_test.c
+++ b/picoquictest/tls_api_test.c
@@ -23,7 +23,7 @@
 #include "tls_api.h"
 #include "picoquictest_internal.h"
 #ifdef _WINDOWS
-#include "..\picoquic\wincompat.h"
+#include "wincompat.h"
 #endif
 #include <picotls.h>
 #include <stddef.h>
@@ -37,6 +37,8 @@
 #define PICOQUIC_TEST_WRONG_ALPN "picoquic-bla-bla"
 #define PICOQUIC_TEST_MAX_TEST_STREAMS 8
 
+char const * picoquic_test_solution_dir = NULL;
+
 static const uint8_t test_ticket_encrypt_key[32] = {
     0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
     16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
@@ -164,6 +166,11 @@ static test_api_stream_desc_t test_scenario_many_streams[] = {
     { 32, 0, 32, 1500 }
 };
 
+void picoquic_test_set_solution_dir(char const * solution_dir)
+{
+    picoquic_test_solution_dir = solution_dir;
+}
+
 static int test_api_init_stream_buffers(size_t len, uint8_t** src_bytes, uint8_t** rcv_bytes)
 {
     int ret = 0;
@@ -615,6 +622,23 @@ static int tls_api_init_ctx(picoquic_test_tls_api_ctx_t** pctx, uint32_t propose
     int ret = 0;
     picoquic_test_tls_api_ctx_t* test_ctx = (picoquic_test_tls_api_ctx_t*)
         malloc(sizeof(picoquic_test_tls_api_ctx_t));
+    char test_server_cert_file[512];
+    char test_server_key_file[512];
+    char test_server_cert_store_file[512];
+
+    ret = picoquic_get_input_path(test_server_cert_file, sizeof(test_server_cert_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_CERT);
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_key_file, sizeof(test_server_key_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_KEY);
+    }
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_cert_store_file, sizeof(test_server_cert_store_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_CERT_STORE);
+    }
+
+    if (ret != 0) {
+        DBG_PRINTF("%s", "Cannot set the cert, key or store file names.\n");
+    }
 
     *pctx = test_ctx;
 
@@ -643,12 +667,12 @@ static int tls_api_init_ctx(picoquic_test_tls_api_ctx_t** pctx, uint32_t propose
         test_ctx->server_addr.sin_port = 4321;
 
         /* Test the creation of the client and server contexts */
-        test_ctx->qclient = picoquic_create(8, NULL, NULL, PICOQUIC_TEST_CERT_STORE, NULL, test_api_callback,
+        test_ctx->qclient = picoquic_create(8, NULL, NULL, test_server_cert_store_file, NULL, test_api_callback,
             (void*)&test_ctx->client_callback, NULL, NULL, NULL, *p_simulated_time,
             p_simulated_time, ticket_file_name, NULL, 0);
 
         test_ctx->qserver = picoquic_create(8,
-            PICOQUIC_TEST_SERVER_CERT, PICOQUIC_TEST_SERVER_KEY, PICOQUIC_TEST_CERT_STORE,
+            test_server_cert_file, test_server_key_file, test_server_cert_store_file,
             PICOQUIC_TEST_ALPN, test_api_callback, (void*)&test_ctx->server_callback, NULL, NULL, NULL,
             *p_simulated_time, p_simulated_time, NULL,
             (use_bad_crypt == 0) ? test_ticket_encrypt_key : test_ticket_badcrypt_key,
@@ -2347,8 +2371,27 @@ int bad_certificate_test()
     uint64_t simulated_time = 0;
     uint64_t loss_mask = 0;
     picoquic_test_tls_api_ctx_t* test_ctx = NULL;
+    char test_server_cert_file[512];
+    char test_server_key_file[512];
+    char test_server_cert_store_file[512];
     int ret = tls_api_init_ctx(&test_ctx, 0, PICOQUIC_TEST_SNI, PICOQUIC_TEST_ALPN, &simulated_time, NULL, 0, 0, 0);
 
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_cert_file, sizeof(test_server_cert_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_BAD_CERT);
+
+        if (ret == 0) {
+            ret = picoquic_get_input_path(test_server_key_file, sizeof(test_server_key_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_KEY);
+        }
+
+        if (ret == 0) {
+            ret = picoquic_get_input_path(test_server_cert_store_file, sizeof(test_server_cert_store_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_CERT_STORE);
+        }
+
+        if (ret != 0) {
+            DBG_PRINTF("%s", "Cannot set the cert, key or store file names.\n");
+        }
+    }
+
     /* Delete the server context, and recreate it with the bad certificate */
 
     if (ret == 0)
@@ -2358,7 +2401,7 @@ int bad_certificate_test()
         }
 
         test_ctx->qserver = picoquic_create(8,
-            PICOQUIC_TEST_SERVER_BAD_CERT, PICOQUIC_TEST_SERVER_KEY, PICOQUIC_TEST_CERT_STORE,
+            test_server_cert_file, test_server_key_file, test_server_cert_store_file,
             PICOQUIC_TEST_ALPN, test_api_callback, (void*)&test_ctx->server_callback, NULL, NULL, NULL,
             simulated_time, &simulated_time, NULL,
             test_ticket_encrypt_key, sizeof(test_ticket_encrypt_key));
@@ -2425,9 +2468,28 @@ int set_verify_certificate_callback_test()
     uint64_t loss_mask = 0;
     picoquic_test_tls_api_ctx_t* test_ctx = NULL;
     int call_count = 0;
+    char test_server_cert_file[512];
+    char test_server_key_file[512];
+    char test_server_cert_store_file[512];
     int ret = tls_api_init_ctx(&test_ctx, PICOQUIC_INTERNAL_TEST_VERSION_1,
         PICOQUIC_TEST_SNI, PICOQUIC_TEST_ALPN, &simulated_time, NULL, 0, 0, 0);
 
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_cert_file, sizeof(test_server_cert_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_CERT);
+    }
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_key_file, sizeof(test_server_key_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_KEY);
+    }
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_cert_store_file, sizeof(test_server_cert_store_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_CERT_STORE);
+    }
+
+    if (ret != 0) {
+        DBG_PRINTF("%s", "Cannot set the cert, key or store file names.\n");
+    }
+
     /* Delete the client context, and recreate with a certificate */
     if (ret == 0) {
         if (test_ctx->qclient != NULL) {
@@ -2436,7 +2498,7 @@ int set_verify_certificate_callback_test()
         }
 
         test_ctx->qclient = picoquic_create(8,
-            PICOQUIC_TEST_SERVER_CERT, PICOQUIC_TEST_SERVER_KEY, PICOQUIC_TEST_CERT_STORE,
+            test_server_cert_file, test_server_key_file, test_server_cert_store_file,
             NULL, test_api_callback, (void*)&test_ctx->client_callback, NULL, NULL, NULL,
             simulated_time, &simulated_time, NULL, NULL, 0);
 
@@ -2504,40 +2566,52 @@ int virtual_time_test()
     uint64_t current_time = picoquic_current_time();
     uint64_t ptls_time = 0;
     uint8_t callback_ctx[256];
+    char test_server_cert_store_file[512];
+    picoquic_quic_t * qsimul = NULL;
+    picoquic_quic_t * qdirect = NULL;
 
+    ret = picoquic_get_input_path(test_server_cert_store_file, sizeof(test_server_cert_store_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_CERT_STORE);
 
-    picoquic_quic_t * qsimul = picoquic_create(8, NULL, NULL, PICOQUIC_TEST_CERT_STORE, 
-        NULL, test_api_callback,
-        (void*)callback_ctx, NULL, NULL, NULL, simulated_time,
-        &simulated_time, ticket_file_name, NULL, 0);
-    picoquic_quic_t * qdirect = picoquic_create(8, NULL, NULL, PICOQUIC_TEST_CERT_STORE, 
-        NULL, test_api_callback,
-        (void*)callback_ctx, NULL, NULL, NULL, current_time,
-        NULL, ticket_file_name, NULL, 0);
-
-    if (qsimul == NULL || qdirect == NULL)
-    {
-        ret = -1;
+    if (ret != 0) {
+        DBG_PRINTF("%s", "Cannot set the cert, key or store file names.\n");
     }
-    else
-    {
-        /* Check that the simulated time follows the simulation */
-        for (int i = 0; ret == 0 && i < 5; i++) {
-            simulated_time += 12345678;
-            test_time = picoquic_get_quic_time(qsimul);
-            ptls_time = picoquic_get_tls_time(qsimul);
-            if (test_time != simulated_time) {
-                DBG_PRINTF("Test time: %llu != Simulated: %llu",
-                    (unsigned long long)test_time,
-                    (unsigned long long)simulated_time);
-                ret = -1;
-            } else if (ptls_time < (test_time / 1000) || ptls_time >(test_time / 1000) + 1) {
-                DBG_PRINTF("Test time: %llu does match ptls time: %llu",
-                    (unsigned long long)test_time,
-                    (unsigned long long)ptls_time);
-                ret = -1;
+    else {
+
+        qsimul = picoquic_create(8, NULL, NULL, test_server_cert_store_file,
+            NULL, test_api_callback,
+            (void*)callback_ctx, NULL, NULL, NULL, simulated_time,
+            &simulated_time, ticket_file_name, NULL, 0);
+        qdirect = picoquic_create(8, NULL, NULL, PICOQUIC_TEST_FILE_CERT_STORE,
+            NULL, test_api_callback,
+            (void*)callback_ctx, NULL, NULL, NULL, current_time,
+            NULL, ticket_file_name, NULL, 0);
+
+        if (qsimul == NULL || qdirect == NULL)
+        {
+            ret = -1;
+        }
+        else
+        {
+            /* Check that the simulated time follows the simulation */
+            for (int i = 0; ret == 0 && i < 5; i++) {
+                simulated_time += 12345678;
+                test_time = picoquic_get_quic_time(qsimul);
+                ptls_time = picoquic_get_tls_time(qsimul);
+                if (test_time != simulated_time) {
+                    DBG_PRINTF("Test time: %llu != Simulated: %llu",
+                        (unsigned long long)test_time,
+                        (unsigned long long)simulated_time);
+                    ret = -1;
+                }
+                else if (ptls_time < (test_time / 1000) || ptls_time >(test_time / 1000) + 1) {
+                    DBG_PRINTF("Test time: %llu does match ptls time: %llu",
+                        (unsigned long long)test_time,
+                        (unsigned long long)ptls_time);
+                    ret = -1;
+                }
             }
         }
+
         /* Check that the non simulated time follows the current time */
         for (int i = 0; ret == 0 && i < 5; i++) {
 #ifdef _WINDOWS
@@ -2562,7 +2636,8 @@ int virtual_time_test()
                         (unsigned long long)test_time,
                         (unsigned long long)current_time);
                     ret = -1;
-                } else if (ptls_time < (test_time / 1000) || ptls_time >(test_time / 1000) + 1) {
+                }
+                else if (ptls_time < (test_time / 1000) || ptls_time >(test_time / 1000) + 1) {
                     DBG_PRINTF("Test current time: %llu does match ptls time: %llu",
                         (unsigned long long)test_time,
                         (unsigned long long)ptls_time);
@@ -2629,8 +2704,27 @@ int set_certificate_and_key_test()
     uint64_t simulated_time = 0;
     uint64_t loss_mask = 0;
     picoquic_test_tls_api_ctx_t* test_ctx = NULL;
+    char test_server_cert_file[512];
+    char test_server_key_file[512];
+    char test_server_cert_store_file[512];
     int ret = tls_api_init_ctx(&test_ctx, 0, PICOQUIC_TEST_SNI, PICOQUIC_TEST_ALPN, &simulated_time, NULL, 0, 0, 0);
 
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_cert_file, sizeof(test_server_cert_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_CERT);
+    }
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_key_file, sizeof(test_server_key_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_KEY);
+    }
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_cert_store_file, sizeof(test_server_cert_store_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_CERT_STORE);
+    }
+
+    if (ret != 0) {
+        DBG_PRINTF("%s", "Cannot set the cert, key or store file names.\n");
+    }
+
     /* Delete the server context, and recreate it. */
     if (ret == 0)
     {
@@ -2649,7 +2743,7 @@ int set_certificate_and_key_test()
         }
 
         if (ret == 0) {
-            BIO* bio_key = BIO_new_file(PICOQUIC_TEST_SERVER_KEY, "rb");
+            BIO* bio_key = BIO_new_file(test_server_key_file, "rb");
             /* Load key and convert to DER */
             EVP_PKEY* key = PEM_read_bio_PrivateKey(bio_key, NULL, NULL, NULL);
             int length = i2d_PrivateKey(key, NULL);
@@ -2665,7 +2759,7 @@ int set_certificate_and_key_test()
         }
 
         if (ret == 0) {
-            BIO* bio_key = BIO_new_file(PICOQUIC_TEST_SERVER_CERT, "rb");
+            BIO* bio_key = BIO_new_file(test_server_cert_file, "rb");
             /* Load cert and convert to DER */
             X509* cert = PEM_read_bio_X509(bio_key, NULL, NULL, NULL);
             int length = i2d_X509(cert, NULL);
@@ -2686,7 +2780,7 @@ int set_certificate_and_key_test()
         }
 
         if (ret == 0) {
-            BIO* bio_key = BIO_new_file(PICOQUIC_TEST_CERT_STORE, "rb");
+            BIO* bio_key = BIO_new_file(test_server_cert_store_file, "rb");
             /* Load cert and convert to DER */
             X509* cert = PEM_read_bio_X509(bio_key, NULL, NULL, NULL);
             int length = i2d_X509(cert, NULL);
@@ -2729,7 +2823,25 @@ int request_client_authentication_test()
     uint64_t simulated_time = 0;
     uint64_t loss_mask = 0;
     picoquic_test_tls_api_ctx_t* test_ctx = NULL;
-    int ret = tls_api_init_ctx(&test_ctx, 0, PICOQUIC_TEST_SNI, PICOQUIC_TEST_ALPN, &simulated_time, NULL, 0, 0, 0);
+    char test_server_cert_file[512];
+    char test_server_key_file[512];
+    char test_server_cert_store_file[512];
+    int ret = picoquic_get_input_path(test_server_cert_file, sizeof(test_server_cert_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_CERT);
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_key_file, sizeof(test_server_key_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_KEY);
+    }
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_cert_store_file, sizeof(test_server_cert_store_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_CERT_STORE);
+    }
+
+    if (ret != 0) {
+        DBG_PRINTF("%s", "Cannot set the cert, key or store file names.\n");
+    }
+    else {
+        ret = tls_api_init_ctx(&test_ctx, 0, PICOQUIC_TEST_SNI, PICOQUIC_TEST_ALPN, &simulated_time, NULL, 0, 0, 0);
+    }
 
     if (ret == 0 && test_ctx == NULL) {
         ret = -1;
@@ -2744,7 +2856,7 @@ int request_client_authentication_test()
         }
 
         test_ctx->qclient = picoquic_create(8,
-            PICOQUIC_TEST_SERVER_CERT, PICOQUIC_TEST_SERVER_KEY, PICOQUIC_TEST_CERT_STORE,
+            test_server_cert_file, test_server_key_file, test_server_cert_store_file,
             NULL, test_api_callback, (void*)&test_ctx->client_callback, NULL, NULL, NULL,
             simulated_time, &simulated_time, NULL, NULL, 0);
 
@@ -2799,7 +2911,29 @@ int bad_client_certificate_test()
     uint64_t simulated_time = 0;
     uint64_t loss_mask = 0;
     picoquic_test_tls_api_ctx_t* test_ctx = NULL;
-    int ret = tls_api_init_ctx(&test_ctx, 0, PICOQUIC_TEST_SNI, PICOQUIC_TEST_ALPN, &simulated_time, NULL, 0, 0, 0);
+    char test_server_cert_file[512];
+    char test_server_key_file[512];
+    char test_server_cert_store_file[512];
+    int ret = picoquic_get_input_path(test_server_cert_file, sizeof(test_server_cert_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_BAD_CERT);
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_key_file, sizeof(test_server_key_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_KEY);
+    }
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_cert_store_file, sizeof(test_server_cert_store_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_CERT_STORE);
+    }
+
+    if (ret != 0) {
+        DBG_PRINTF("%s", "Cannot set the cert, key or store file names.\n");
+    }
+    else {
+        ret = tls_api_init_ctx(&test_ctx, 0, PICOQUIC_TEST_SNI, PICOQUIC_TEST_ALPN, &simulated_time, NULL, 0, 0, 0);
+    }
+
+    if (ret == 0 && test_ctx == NULL) {
+        ret = -1;
+    }
 
     /* Delete the client context, and recreate with a certificate */
     if (ret == 0)
@@ -2810,7 +2944,7 @@ int bad_client_certificate_test()
         }
 
         test_ctx->qclient = picoquic_create(8,
-            PICOQUIC_TEST_SERVER_BAD_CERT, PICOQUIC_TEST_SERVER_KEY, PICOQUIC_TEST_CERT_STORE,
+            test_server_cert_file, test_server_key_file, test_server_cert_store_file,
             NULL, test_api_callback, (void*)&test_ctx->client_callback, NULL, NULL, NULL,
             simulated_time, &simulated_time, NULL, NULL, 0);
 
@@ -4928,13 +5062,9 @@ int padding_test()
  * and verifying that the log file is what we expect.
  */
 #ifdef _WINDOWS
-#ifndef _WINDOWS64
-static char const* packet_trace_test_ref = "..\\picoquictest\\packet_trace_ref.txt";
-#else
-static char const* packet_trace_test_ref = "..\\..\\picoquictest\\packet_trace_ref.txt";
-#endif
+#define PACKET_TRACE_TEST_REF "picoquictest\\packet_trace_ref.txt"
 #else
-static char const* packet_trace_test_ref = "picoquictest/packet_trace_ref.txt";
+#define PACKET_TRACE_TEST_REF "picoquictest/packet_trace_ref.txt"
 #endif
 
 int packet_trace_test()
@@ -4999,7 +5129,16 @@ int packet_trace_test()
     /* compare the log file to the expected value */
     if (ret == 0)
     {
-        ret = picoquic_test_compare_files(trace_file_name, packet_trace_test_ref);
+        char packet_trace_test_ref[512];
+
+        ret = picoquic_get_input_path(packet_trace_test_ref, sizeof(packet_trace_test_ref), picoquic_test_solution_dir, PACKET_TRACE_TEST_REF);
+
+        if (ret != 0) {
+            DBG_PRINTF("%s", "Cannot set the packet trace test ref file name.\n");
+        }
+        else {
+            ret = picoquic_test_compare_files(trace_file_name, packet_trace_test_ref);
+        }
     }
 
     return ret;
diff --git a/picoquictest/transport_param_test.c b/picoquictest/transport_param_test.c
index 493a4f53..d4687d3d 100644
--- a/picoquictest/transport_param_test.c
+++ b/picoquictest/transport_param_test.c
@@ -463,23 +463,45 @@ int transport_param_set_contexts(picoquic_quic_t ** quic_ctx, picoquic_cnx_t **
     picoquic_connection_id_t initial_cnx_id = { { 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0 }, 8 };
     picoquic_connection_id_t remote_cnx_id = { { 0, 1, 2, 3, 4, 5, 6, 7,  0, 0, 0, 0, 0, 0, 0, 0 }, 8 };
     struct sockaddr_in addr;
+    char test_server_cert_file[512];
+    char test_server_key_file[512];
+    char test_server_cert_store_file[512];
 
-    memset(&addr, 0, sizeof(struct sockaddr_in));
-    addr.sin_family = AF_INET;
-
+    *quic_ctx = NULL;
     *test_cnx = NULL;
-    *quic_ctx = picoquic_create(8,
-        PICOQUIC_TEST_SERVER_CERT, PICOQUIC_TEST_SERVER_KEY, PICOQUIC_TEST_CERT_STORE,
-        PICOQUIC_TEST_ALPN, NULL, NULL, NULL, NULL, NULL,
-        *p_simulated_time, p_simulated_time, NULL, NULL, 1);
-
-    if (*quic_ctx != NULL) {
-        *test_cnx = picoquic_create_cnx(*quic_ctx, initial_cnx_id, remote_cnx_id,
-            (struct sockaddr*) &addr, 0, 0, "sni", "alpn", (mode==0)?1:0);
+
+    ret = picoquic_get_input_path(test_server_cert_file, sizeof(test_server_cert_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_CERT);
+
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_key_file, sizeof(test_server_key_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_SERVER_KEY);
     }
 
-    if (*quic_ctx == NULL || *test_cnx == NULL) {
-        ret = -1;
+    if (ret == 0) {
+        ret = picoquic_get_input_path(test_server_cert_store_file, sizeof(test_server_cert_store_file), picoquic_test_solution_dir, PICOQUIC_TEST_FILE_CERT_STORE);
+    }
+
+    if (ret != 0) {
+        DBG_PRINTF("%s", "Cannot set the cert, key or store file names.\n");
+    }
+    else {
+
+        memset(&addr, 0, sizeof(struct sockaddr_in));
+        addr.sin_family = AF_INET;
+
+        *quic_ctx = picoquic_create(8,
+            test_server_cert_file, test_server_key_file, test_server_cert_store_file,
+            PICOQUIC_TEST_ALPN, NULL, NULL, NULL, NULL, NULL,
+            *p_simulated_time, p_simulated_time, NULL, NULL, 1);
+
+
+        if (*quic_ctx != NULL) {
+            *test_cnx = picoquic_create_cnx(*quic_ctx, initial_cnx_id, remote_cnx_id,
+                (struct sockaddr*) &addr, 0, 0, "sni", "alpn", (mode == 0) ? 1 : 0);
+        }
+
+        if (*quic_ctx == NULL || *test_cnx == NULL) {
+            ret = -1;
+        }
     }
 
     return ret;
@@ -839,13 +861,9 @@ static char const* log_tp_test_file = "log_tp_test.txt";
 static char const* log_tp_fuzz_file = "log_tp_fuzz_test.txt";
 
 #ifdef _WINDOWS
-#ifndef _WINDOWS64
-static char const* log_tp_test_ref = "..\\picoquictest\\log_tp_test_ref.txt";
-#else
-static char const* log_tp_test_ref = "..\\..\\picoquictest\\log_tp_test_ref.txt";
-#endif
+#define LOG_TP_TEST_REF "picoquictest\\log_tp_test_ref.txt"
 #else
-static char const* log_tp_test_ref = "picoquictest/log_tp_test_ref.txt";
+#define LOG_TP_TEST_REF "picoquictest/log_tp_test_ref.txt"
 #endif
 
 void picoquic_log_transport_extension_content(FILE* F, int log_cnxid, uint64_t cnx_id_64,
@@ -952,7 +970,15 @@ int transport_param_log_test()
 
     if (ret == 0)
     {
-        ret = picoquic_test_compare_files(log_tp_test_file, log_tp_test_ref);
+        char log_tp_test_ref[512];
+
+        ret = picoquic_get_input_path(log_tp_test_ref, sizeof(log_tp_test_ref), picoquic_test_solution_dir, LOG_TP_TEST_REF);
+
+        if (ret != 0) {
+            DBG_PRINTF("%s", "Cannot set the log TP ref file name.\n");
+        } else {
+            ret = picoquic_test_compare_files(log_tp_test_file, log_tp_test_ref);
+        }
     }
 
     if (ret == 0)
-- 
GitLab