VirtualBox

Ignore:
Timestamp:
Apr 20, 2023 10:16:10 AM (20 months ago)
Author:
vboxsync
Message:

IPRT/RTProcCreateEx: More fixes for the initial patch supplied; also tweaked the testcases a little. bugref:8053

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstRTProcCreateEx.cpp

    r99151 r99483  
    107107    const char *pszCWD = argv[2];
    108108
     109    RTStrmPrintf(g_pStdOut, "childcwd: Called with CWD '%s'\n", pszCWD);
     110
     111    if (!RTStrICmp(pszCWD, "<cwd-not-specified>")) /* Bail out early if no CWD has been explicitly specified. */
     112        return RTEXITCODE_SUCCESS;
     113
    109114    /* Validate if we really are in the CWD the parent told us. */
    110115    char szCWD[RTPATH_MAX];
     
    155160        g_szExecName,
    156161        "--testcase-child-cwd",
    157         "<invalid-cwd>",
     162        "<cwd-not-specified>",
    158163        pszAsUser,
    159164        NULL
     
    171176                          VERR_INVALID_PARAMETER);
    172177
     178    /* Invalid flag combinations. Windows flags ignored elsewhere. */
     179#ifdef RT_OS_WINDOWS
     180    int rc = VERR_INVALID_PARAMETER;
     181#else
     182    int rc = VERR_INVALID_POINTER; /* Due to missing pvExtraData. */
     183#endif
     184    fFlags = RTPROC_FLAGS_CWD | RTPROC_FLAGS_DESIRED_SESSION_ID | RTPROC_FLAGS_SERVICE;
     185    RTTESTI_CHECK_RC_RETV(RTProcCreateEx(g_szExecName, apszArgs, RTENV_DEFAULT, fFlags,
     186                                         NULL, NULL, NULL, pszAsUser, pszPassword,
     187                                         NULL, &hProc), rc);
     188
     189    /* Windows-only flags. Ignored elsewhere. */
     190#ifdef RT_OS_WINDOWS
     191    rc = VERR_INVALID_POINTER;
     192#else
     193    rc = VINF_SUCCESS;
     194#endif
     195    fFlags = RTPROC_FLAGS_DESIRED_SESSION_ID | RTPROC_FLAGS_SERVICE;
     196    RTTESTI_CHECK_RC_RETV(RTProcCreateEx(g_szExecName, apszArgs, RTENV_DEFAULT, fFlags,
     197                                         NULL, NULL, NULL, pszAsUser, pszPassword,
     198                                         NULL, &hProc), rc);
     199
    173200    /* RTPROC_FLAGS_CWD set, but CWD missing as pvExtradata. */
    174201    fFlags = RTPROC_FLAGS_CWD;
     
    176203                                         NULL, NULL, NULL, pszAsUser, pszPassword,
    177204                                         NULL, &hProc),
    178                           VINF_SUCCESS);
    179 
    180     /* CWD is "<invalid-cwd>" from above, should fail. */
    181     RTPROCSTATUS ProcStatus = { -1, RTPROCEXITREASON_ABEND };
    182     RTTESTI_CHECK_RC(RTProcWait(hProc, RTPROCWAIT_FLAGS_BLOCK, &ProcStatus), VINF_SUCCESS);
     205                          VERR_INVALID_POINTER);
    183206
    184207    char szCWD[RTPATH_MAX];
     
    193216                                         (void *)szCWD /* pvExtraData (CWD) */, &hProc),
    194217                          VINF_SUCCESS);
     218    RTPROCSTATUS ProcStatus = { -1, RTPROCEXITREASON_ABEND };
    195219    RTTESTI_CHECK_RC(RTProcWait(hProc, RTPROCWAIT_FLAGS_BLOCK, &ProcStatus), VINF_SUCCESS);
    196220    if (ProcStatus.enmReason != RTPROCEXITREASON_NORMAL || ProcStatus.iStatus != 0)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette