VirtualBox

Changeset 90084 in vbox


Ignore:
Timestamp:
Jul 8, 2021 7:42:18 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145583
Message:

Audio/ValKit: Added daemonizing testing support for VKAT / VBoxAudioTest, as TXS (on the guest) does not allow starting programs in the background. bugref:10008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp

    r90079 r90084  
    114114{
    115115    VKAT_TEST_OPT_COUNT = 900,
     116    VKAT_TEST_OPT_DAEMONIZE,
     117    VKAT_TEST_OPT_DAEMONIZED,
    116118    VKAT_TEST_OPT_DEV,
    117119    VKAT_TEST_OPT_GUEST_ATS_ADDR,
     
    167169    { "--outdir",            VKAT_TEST_OPT_OUTDIR,         RTGETOPT_REQ_STRING  },
    168170    { "--count",             VKAT_TEST_OPT_COUNT,          RTGETOPT_REQ_UINT32  },
     171    { "--daemonize",         VKAT_TEST_OPT_DAEMONIZE,      RTGETOPT_REQ_NOTHING },
     172    { "--daemonized",        VKAT_TEST_OPT_DAEMONIZED,     RTGETOPT_REQ_NOTHING },
    169173    { "--device",            VKAT_TEST_OPT_DEV,            RTGETOPT_REQ_STRING  },
    170174    { "--pause",             VKAT_TEST_OPT_PAUSE,          RTGETOPT_REQ_UINT32  },
     
    628632        case 'e':                          return "Exclude the given test id from the list";
    629633        case 'i':                          return "Include the given test id in the list";
     634        case VKAT_TEST_OPT_DAEMONIZE:      return "Run in background (daemonized)";
    630635        case VKAT_TEST_OPT_DEV:            return "Use the specified audio device";
    631636        case VKAT_TEST_OPT_GUEST_ATS_ADDR: return "Address of guest ATS to connect to";
     
    671676    bool        fPcmSigned    = true;
    672677
     678    bool        fDaemonize    = false;
     679    bool        fDaemonized   = false;
     680
    673681    const char *pszGuestTcpAddr  = NULL;
    674682    uint16_t    uGuestTcpPort    = ATS_TCP_DEF_BIND_PORT_GUEST;
     
    738746                return RTMsgErrorExitFailure("Not yet implemented!");
    739747
     748            case VKAT_TEST_OPT_DAEMONIZE:
     749                fDaemonize = true;
     750                break;
     751
     752            case VKAT_TEST_OPT_DAEMONIZED:
     753                fDaemonized = true;
     754                break;
     755
    740756            case VKAT_TEST_OPT_DEV:
    741757                rc = RTStrCopy(TstEnv.szDev, sizeof(TstEnv.szDev), ValueUnion.psz);
     
    789805                if (RT_FAILURE(rc))
    790806                    return RTGetOptPrintError(rc, &ValueUnion);
     807        }
     808    }
     809
     810    /*
     811     * Daemonize ourselves if asked to.
     812     */
     813    if (fDaemonize)
     814    {
     815        if (!fDaemonized)
     816        {
     817            if (g_uVerbosity > 0)
     818                RTMsgInfo("Daemonizing...");
     819            rc = RTProcDaemonize(pGetState->argv, "--daemonized");
     820            if (RT_FAILURE(rc))
     821                return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTProcDaemonize: %Rrc\n", rc);
     822            return RTEXITCODE_SUCCESS;
     823        }
     824        else
     825        {
     826            if (g_uVerbosity > 0)
     827                RTMsgInfo("Running daemonized ...");
    791828        }
    792829    }
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