]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tests/parse_config_file: add tests for lxc.time.offset.*
authorAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Tue, 2 Apr 2024 09:13:21 +0000 (11:13 +0200)
committerAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Tue, 2 Apr 2024 10:22:16 +0000 (12:22 +0200)
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
src/tests/parse_config_file.c

index d0a285c1dd4ad9aa365be3dc6d8e7eb2149d4173..efca0ae8dd1d60503669df3eb3c761a8915541fb 100644 (file)
@@ -940,6 +940,31 @@ int main(int argc, char *argv[])
                goto non_test_error;
        }
 
+       if (set_get_compare_clear_save_load(c, "lxc.time.offset.boot", "-1234s", tmpf, true) < 0) {
+               lxc_error("%s\n", "lxc.time.offset.boot");
+               goto non_test_error;
+       }
+
+       if (!c->set_config_item(c, "lxc.time.offset.boot", "1000000000000000us")) {
+               lxc_error("%s\n", "Failed to set a valid value (1000000000000000us) to config item \"lxc.time.offset.boot\"");
+               goto non_test_error;
+       }
+
+       if (!c->set_config_item(c, "lxc.time.offset.boot", "-1000000000000000us")) {
+               lxc_error("%s\n", "Failed to set a valid (-1000000000000000us) value to config item \"lxc.time.offset.boot\"");
+               goto non_test_error;
+       }
+
+       if (c->set_config_item(c, "lxc.time.offset.boot", "10000000000000000us")) {
+               lxc_error("%s\n", "Managed to set overflowed value to config item \"lxc.time.offset.boot\"");
+               goto non_test_error;
+       }
+
+       if (set_get_compare_clear_save_load(c, "lxc.time.offset.monotonic", "4321s", tmpf, true) < 0) {
+               lxc_error("%s\n", "lxc.time.offset.monotonic");
+               goto non_test_error;
+       }
+
        fret = EXIT_SUCCESS;
 
 non_test_error: