]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
unit-tests: Adapt settings tests for Windows
authorMartin Willi <martin@revosec.ch>
Tue, 4 Mar 2014 13:00:11 +0000 (14:00 +0100)
committerMartin Willi <martin@revosec.ch>
Wed, 4 Jun 2014 13:53:09 +0000 (15:53 +0200)
src/libstrongswan/tests/suites/test_settings.c

index 97e45fc04e019e3bd9bd10f0d572cef6c8450509..32676be26ae9a501c25d61b0664bd45c655a2f8f 100644 (file)
 #include <utils/utils.h>
 #include <collections/linked_list.h>
 
+#ifdef WIN32
+static char *path = "C:\\Windows\\Temp\\strongswan-settings-test";
+#else
 static char *path = "/tmp/strongswan-settings-test";
+#endif
 static settings_t *settings;
 
 static void create_settings(chunk_t contents)
@@ -522,8 +526,13 @@ START_TEST(test_key_value_enumerator)
 }
 END_TEST
 
-#define include1 "/tmp/strongswan-settings-test-include1"
-#define include2 "/tmp/strongswan-settings-test-include2"
+#ifdef WIN32
+# define include1 "C:\\Windows\\Temp\\strongswan-settings-test-include1"
+# define include2 "C:\\Windows\\Temp\\strongswan-settings-test-include2"
+#else
+# define include1 "/tmp/strongswan-settings-test-include1"
+# define include2 "/tmp/strongswan-settings-test-include2"
+#endif
 
 START_SETUP(setup_include_config)
 {
@@ -675,6 +684,7 @@ START_TEST(test_load_files_section)
        ck_assert(!settings->load_files_section(settings, include1".conf", TRUE, ""));
        verify_include();
 
+#ifndef WIN32
        /* unreadable files are too (only fails when not running as root) */
        if (getuid() != 0)
        {
@@ -683,6 +693,7 @@ START_TEST(test_load_files_section)
                unlink(include1".no");
                verify_include();
        }
+#endif
 
        ck_assert(settings->load_files_section(settings, include2, FALSE, "main"));
        verify_null("main.key1");