VirtualBox

Ignore:
Timestamp:
Feb 15, 2022 8:33:16 AM (3 years ago)
Author:
vboxsync
Message:

Validation Kit/TxS: Added log rotation plus a bit more OS info for release logging so that we can detect if TxS had several runs during testing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/TestExecServ/TestExecService.cpp

    r93732 r93747  
    30343034static RTEXITCODE txsMainLoop(void)
    30353035{
    3036     RTMsgInfo("Version %s r%s %s.%s (%s %s)\n",
    3037               RTBldCfgVersion(), RTBldCfgRevisionStr(), KBUILD_TARGET, KBUILD_TARGET_ARCH, __DATE__, __TIME__);
    3038 
    30393036    if (g_cVerbose > 0)
    30403037        RTMsgInfo("txsMainLoop: start...\n");
     
    37843781}
    37853782
     3783/**
     3784 * @callback_method_impl{FNRTLOGPHASE, Release logger callback}
     3785 */
     3786static DECLCALLBACK(void) logHeaderFooter(PRTLOGGER pLoggerRelease, RTLOGPHASE enmPhase, PFNRTLOGPHASEMSG pfnLog)
     3787{
     3788    /* Some introductory information. */
     3789    static RTTIMESPEC s_TimeSpec;
     3790    char szTmp[256];
     3791    if (enmPhase == RTLOGPHASE_BEGIN)
     3792        RTTimeNow(&s_TimeSpec);
     3793    RTTimeSpecToString(&s_TimeSpec, szTmp, sizeof(szTmp));
     3794
     3795    switch (enmPhase)
     3796    {
     3797        case RTLOGPHASE_BEGIN:
     3798        {
     3799            pfnLog(pLoggerRelease,
     3800                   "TestExecService (Validation Kit TxS) %s r%s (verbosity: %u) %s %s (%s %s) release log\n"
     3801                   "(C) " VBOX_C_YEAR " " VBOX_VENDOR "\n"
     3802                   "All rights reserved.\n\n"
     3803                   "Log opened %s\n",
     3804                   RTBldCfgVersion(), RTBldCfgRevisionStr(), g_cVerbose,
     3805                   KBUILD_TARGET, KBUILD_TARGET_ARCH,
     3806                   __DATE__, __TIME__, szTmp);
     3807
     3808            int vrc = RTSystemQueryOSInfo(RTSYSOSINFO_PRODUCT, szTmp, sizeof(szTmp));
     3809            if (RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW)
     3810                pfnLog(pLoggerRelease, "OS Product: %s\n", szTmp);
     3811            vrc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szTmp, sizeof(szTmp));
     3812            if (RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW)
     3813                pfnLog(pLoggerRelease, "OS Release: %s\n", szTmp);
     3814            vrc = RTSystemQueryOSInfo(RTSYSOSINFO_VERSION, szTmp, sizeof(szTmp));
     3815            if (RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW)
     3816                pfnLog(pLoggerRelease, "OS Version: %s\n", szTmp);
     3817            vrc = RTSystemQueryOSInfo(RTSYSOSINFO_SERVICE_PACK, szTmp, sizeof(szTmp));
     3818            if (RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW)
     3819                pfnLog(pLoggerRelease, "OS Service Pack: %s\n", szTmp);
     3820
     3821            /* the package type is interesting for Linux distributions */
     3822            char szExecName[RTPATH_MAX];
     3823            char *pszExecName = RTProcGetExecutablePath(szExecName, sizeof(szExecName));
     3824            pfnLog(pLoggerRelease,
     3825                   "Executable: %s\n"
     3826                   "Process ID: %u\n"
     3827                   "Package type: %s"
     3828#ifdef VBOX_OSE
     3829                   " (OSE)"
     3830#endif
     3831                   "\n",
     3832                   pszExecName ? pszExecName : "unknown",
     3833                   RTProcSelf(),
     3834                   VBOX_PACKAGE_STRING);
     3835            break;
     3836        }
     3837
     3838        case RTLOGPHASE_PREROTATE:
     3839            pfnLog(pLoggerRelease, "Log rotated - Log started %s\n", szTmp);
     3840            break;
     3841
     3842        case RTLOGPHASE_POSTROTATE:
     3843            pfnLog(pLoggerRelease, "Log continuation - Log started %s\n", szTmp);
     3844            break;
     3845
     3846        case RTLOGPHASE_END:
     3847            pfnLog(pLoggerRelease, "End of log file - Log started %s\n", szTmp);
     3848            break;
     3849
     3850        default:
     3851            /* nothing */
     3852            break;
     3853    }
     3854}
    37863855
    37873856int main(int argc, char **argv)
     
    38283897               fFlags |= RTLOGFLAGS_USECRLF;
    38293898#endif
    3830         static const char * const g_apszLogGroups[] = VBOX_LOGGROUP_NAMES;
    3831         rc = RTLogCreate(&g_pRelLogger, fFlags, "all.e.l", "VBOX_TXS_RELEASE_LOG",
    3832                          RT_ELEMENTS(g_apszLogGroups), g_apszLogGroups, RTLOGDEST_STDOUT | RTLOGDEST_FILE, szLogFile);
     3899        static const char * const s_apszLogGroups[] = VBOX_LOGGROUP_NAMES;
     3900        rc = RTLogCreateEx(&g_pRelLogger, "VBOX_TXS_RELEASE_LOG", fFlags, "all",
     3901                           RT_ELEMENTS(s_apszLogGroups), s_apszLogGroups, UINT32_MAX /* cMaxEntriesPerGroup */,
     3902                           0 /*cBufDescs*/, NULL /* paBufDescs */, RTLOGDEST_STDOUT | RTLOGDEST_FILE,
     3903                           logHeaderFooter /* pfnPhase */ ,
     3904                           10 /* cHistory */, 100 * _1M /* cbHistoryFileMax */, RT_SEC_1DAY /* cSecsHistoryTimeSlot */,
     3905                           NULL /* pErrInfo */, "%s", szLogFile);
    38333906        if (RT_SUCCESS(rc))
    38343907        {
     
    38663939        if (RT_SUCCESS(rc))
    38673940            RTMsgInfo("Log file written to '%s'\n", szLogFile);
    3868 
    3869         LogRel((VBOX_PRODUCT " TestExecService (Validation Kit TxS) Version " VBOX_VERSION_STRING " - r%s\n"
    3870                 "(C) " VBOX_C_YEAR " " VBOX_VENDOR "\n"
    3871                 "All rights reserved.\n\n", RTBldCfgRevisionStr()));
    38723941    }
    38733942
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