diff --git a/src/cmd/test/main.c b/src/cmd/test/main.c index fee3c90..b532834 100644 --- a/src/cmd/test/main.c +++ b/src/cmd/test/main.c @@ -47,6 +47,7 @@ CUTE_DECLARE_TEST_CASE(regular_using_tests); CUTE_DECLARE_TEST_CASE(syscall_tracing_mitigation_tests); CUTE_DECLARE_TEST_CASE(debugging_avoidance_tests); CUTE_DECLARE_TEST_CASE(strglob_tests); +CUTE_DECLARE_TEST_CASE(version_tests); #if defined(_WIN32) CUTE_DECLARE_TEST_CASE(get_ntpath_tests); @@ -60,6 +61,7 @@ CUTE_TEST_CASE(cmd_tests) CUTE_RUN_TEST(get_ntpath_tests); #endif CUTE_RUN_TEST(strglob_tests); + CUTE_RUN_TEST(version_tests); CUTE_RUN_TEST(device_install_tests); CUTE_RUN_TEST(device_uninstall_tests); CUTE_RUN_TEST(attach_tests); @@ -85,6 +87,19 @@ CUTE_TEST_CASE(cmd_tests) #endif CUTE_TEST_CASE_END +CUTE_TEST_CASE(version_tests) + FILE *fp; + char out[1024]; + CUTE_ASSERT(zc("version", "> out.txt", NULL) == EXIT_SUCCESS); + fp = fopen("out.txt", "rb"); + CUTE_ASSERT(fp != NULL); + memset(out, 0, sizeof(out)); + fread(out, 1, sizeof(out), fp); + fclose(fp); + CUTE_ASSERT(strcmp(out, "zc version vx20220000\n") == 0); + remove("out.txt"); +CUTE_TEST_CASE_END + CUTE_TEST_CASE(debugging_avoidance_tests) #if defined(_WIN32) char *install_cmd = "install --device-driver-path=..\\..\\dev\\zacarias.sys"; @@ -336,8 +351,12 @@ CUTE_TEST_CASE(regular_using_tests) remove("passwd"); zacarias_uninstall(); + CUTE_ASSERT(zc("version", NULL, NULL) == EXIT_SUCCESS); + CUTE_ASSERT(zacarias_install() == EXIT_SUCCESS); + CUTE_ASSERT(zc("version", NULL, NULL) == EXIT_SUCCESS); + CUTE_ASSERT(zc("attach", "--pwdb=passwd --user=rs --init", "GiveTheMUleWhatHeWants\nGiveTheMuleWhatHeWants\n") != EXIT_SUCCESS); diff --git a/src/cmd/types.h b/src/cmd/types.h index 87c8662..606424b 100644 --- a/src/cmd/types.h +++ b/src/cmd/types.h @@ -35,6 +35,6 @@ extern struct zc_exec_table_ctx g_command_table[]; extern size_t g_command_table_nr; -#define ZC_VERSION "0.0.1" +#define ZC_VERSION "vx20220000" #endif