int main(int argc, char **argv) { if (argc == 2 && !strcmp(argv[1], "--testcase-child-1")) return tstRTCreateProcEx1Child(); if (argc == 2 && !strcmp(argv[1], "--testcase-child-2")) return tstRTCreateProcEx2Child(); if (argc == 2 && !strcmp(argv[1], "--testcase-child-3")) return tstRTCreateProcEx3Child(); if (argc >= 5 && !strcmp(argv[1], "--testcase-child-4")) return tstRTCreateProcEx4Child(argc, argv); if (argc == 2 && !strcmp(argv[1], "--testcase-child-5")) return tstRTCreateProcEx5Child(argc, argv); const char *pszAsUser = NULL; const char *pszPassword = NULL; if (argc != 1) { if (argc != 4 || strcmp(argv[1], "--as-user")) return 99; pszAsUser = argv[2]; pszPassword = argv[3]; } RTTEST hTest; int rc = RTTestInitAndCreate("tstRTProcCreateEx", &hTest); if (rc) return rc; RTTestBanner(hTest); if (!RTProcGetExecutablePath(g_szExecName, sizeof(g_szExecName))) RTStrCopy(g_szExecName, sizeof(g_szExecName), argv[0]); /* * The tests. */ tstRTCreateProcEx1(pszAsUser, pszPassword); tstRTCreateProcEx2(pszAsUser, pszPassword); tstRTCreateProcEx3(pszAsUser, pszPassword); tstRTCreateProcEx4(pszAsUser, pszPassword); if (pszAsUser) tstRTCreateProcEx5(pszAsUser, pszPassword); /** @todo Cover files, ++ */ /* * Summary. */ return RTTestSummaryAndDestroy(hTest); }
int main(int argc, char **argv) { /* * Deal with child processes first. */ if (argc == 2 && !strcmp(argv[1], "--testcase-child-1")) return tstRTCreateProcEx1Child(); if (argc == 2 && !strcmp(argv[1], "--testcase-child-2")) return tstRTCreateProcEx2Child(); if (argc == 2 && !strcmp(argv[1], "--testcase-child-3")) return tstRTCreateProcEx3Child(); if (argc >= 5 && !strcmp(argv[1], "--testcase-child-4")) return tstRTCreateProcEx4Child(argc, argv); if (argc >= 2 && !strcmp(argv[1], "--testcase-child-5")) return tstRTCreateProcEx5Child(argc, argv); if (argc >= 2 && !strcmp(argv[1], "--testcase-child-6")) return tstRTCreateProcEx6Child(argc, argv); /* * Main process. */ const char *pszAsUser = NULL; const char *pszPassword = NULL; if (argc != 1) { if (argc != 4 || strcmp(argv[1], "--as-user")) return 99; pszAsUser = argv[2]; pszPassword = argv[3]; } RTTEST hTest; int rc = RTTestInitAndCreate("tstRTProcCreateEx", &hTest); if (rc) return rc; RTTestBanner(hTest); /* * Init globals. */ if (!RTProcGetExecutablePath(g_szExecName, sizeof(g_szExecName))) RTStrCopy(g_szExecName, sizeof(g_szExecName), argv[0]); RTTESTI_CHECK_RC(RTEnvClone(&g_hEnvInitial, RTENV_DEFAULT), VINF_SUCCESS); /* * The tests. */ tstRTCreateProcEx1(pszAsUser, pszPassword); tstRTCreateProcEx2(pszAsUser, pszPassword); tstRTCreateProcEx3(pszAsUser, pszPassword); tstRTCreateProcEx4(pszAsUser, pszPassword); if (pszAsUser) tstRTCreateProcEx5(pszAsUser, pszPassword); tstRTCreateProcEx6(pszAsUser, pszPassword); /** @todo Cover files, ++ */ RTEnvDestroy(g_hEnvInitial); /* * Summary. */ return RTTestSummaryAndDestroy(hTest); }