VirtualBox

Changeset 99145 in vbox for trunk


Ignore:
Timestamp:
Mar 23, 2023 2:57:45 PM (19 months ago)
Author:
vboxsync
Message:

IPRT/process: Bugfixes for testcases for RTPROC_FLAGS_CWD. bugref:8053

File:
1 edited

Legend:

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

    r99110 r99145  
    112112    if (RT_FAILURE(rc))
    113113    {
    114         RTStrmPrintf(g_pStdErr, "childcwd: Unabled retrieve CWD, rc = %Rrc\n", rc);
    115         return RTEXITCODE_FAILURE;
    116     }
    117 
    118     if (RTStrCmp(szCWD, pszCWD))
    119     {
    120         RTStrmPrintf(g_pStdErr, "childcwd: CWD is '%s', but expected '%s'\n", pszCWD, pszCWD);
    121         return RTEXITCODE_FAILURE;
    122     }
    123 
    124     /* Check if we can query information of the current CWD. */
    125     char *pszUser = NULL;
    126     if (   argc >= 4
    127         && argv[3][0] != '\0')
    128     {
    129         pszUser = argv[3];
    130     }
    131 
    132     RTFSOBJINFO objInfo;
    133     rc = RTPathQueryInfo(pszCWD, &objInfo, RTFSOBJATTRADD_NOTHING);
    134     if (pszUser)
    135         RTStrmPrintf(g_pStdOut, "childcwd: Accessing CWD '%s' via user '%s' -> %Rrc\n", pszCWD, pszUser, rc);
     114        RTStrmPrintf(g_pStdErr, "childcwd: Unable to retrieve CWD, rc=%Rrc\n", rc);
     115        cErrors++;
     116    }
    136117    else
    137         RTStrmPrintf(g_pStdOut, "childcwd: Accesing CWD '%s' -> %Rrc\n", pszCWD, rc);
    138     if (RT_FAILURE(rc))
    139         cErrors++;
    140 
     118    {
     119        if (RTStrCmp(szCWD, pszCWD))
     120        {
     121            RTStrmPrintf(g_pStdErr, "childcwd: CWD is '%s', but expected '%s'\n", szCWD, pszCWD);
     122            cErrors++;
     123        }
     124        else
     125        {
     126            /* Check if we can query information of the current CWD. */
     127            char *pszUser = NULL;
     128            if (   argc >= 4
     129                && argv[3][0] != '\0')
     130            {
     131                pszUser = argv[3];
     132            }
     133
     134            RTFSOBJINFO objInfo;
     135            rc = RTPathQueryInfo(szCWD, &objInfo, RTFSOBJATTRADD_NOTHING);
     136            if (pszUser)
     137                RTStrmPrintf(g_pStdOut, "childcwd: Accessing CWD '%s' via user '%s' -> %Rrc\n", szCWD, pszUser, rc);
     138            else
     139                RTStrmPrintf(g_pStdOut, "childcwd: Accesing CWD '%s' -> %Rrc\n", szCWD, rc);
     140            if (RT_FAILURE(rc))
     141                cErrors++;
     142        }
     143    }
     144
     145    RTStrmPrintf(g_pStdOut, "childcwd: Exiting (%d errors)\n", cErrors);
    141146    return cErrors == 0 ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
    142147}
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