diff options
| author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2022-02-14 15:44:35 +0000 |
|---|---|---|
| committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2022-02-14 15:44:35 +0000 |
| commit | 640aad3d0859aa052d5c7e65ee4297190b2d148c (patch) | |
| tree | cf53b3f9bdf05d1b7733d0265c26611ce6ef11e4 /src/VBox/ValidationKit/utils/TestExecServ | |
| parent | 851b6533b5dda5496db1e117ce9538ff2631ad4b (diff) | |
| download | VirtualBox-svn-640aad3d0859aa052d5c7e65ee4297190b2d148c.tar.gz | |
Validation Kit/TxS: Added release logging (via VBOX_TXS_RELEASE_LOG) to %TEMP%, to instrument testing issues on guests where TxS is being involved.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@93732 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/ValidationKit/utils/TestExecServ')
| -rw-r--r-- | src/VBox/ValidationKit/utils/TestExecServ/TestExecService.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/TestExecService.cpp b/src/VBox/ValidationKit/utils/TestExecServ/TestExecService.cpp index 0bda6832fa1..cdc4dadf9ae 100644 --- a/src/VBox/ValidationKit/utils/TestExecServ/TestExecService.cpp +++ b/src/VBox/ValidationKit/utils/TestExecServ/TestExecService.cpp @@ -60,6 +60,12 @@ #include <iprt/uuid.h> #include <iprt/zip.h> +#include <package-generated.h> +#include "product-generated.h" + +#include <VBox/version.h> +#include <VBox/log.h> + #include "product-generated.h" #include "TestExecServiceInternal.h" @@ -168,6 +174,8 @@ static const PCTXSTRANSPORT g_apTransports[] = //&g_TestDevTransport, }; +/** The release logger. */ +static PRTLOGGER g_pRelLogger; /** The select transport layer. */ static PCTXSTRANSPORT g_pTransport; /** The scratch path. */ @@ -3795,6 +3803,75 @@ int main(int argc, char **argv) return rcExit; /* + * Enable (release) TxS logging to stdout + file. This is independent from the actual test cases being run. + * + * Keep the log file path + naming predictable (the OS' temp dir) so that we later can retrieve it + * from the host side without guessing much. + * + * If enabling logging fails for some reason, just tell but don't bail out to not make tests fail. + */ + char szLogFile[RTPATH_MAX]; + rc = RTPathTemp(szLogFile, sizeof(szLogFile)); + if (RT_SUCCESS(rc)) + { + rc = RTPathAppend(szLogFile, sizeof(szLogFile), "vbox-txs-release.log"); + if (RT_FAILURE(rc)) + RTMsgError("RTPathAppend failed when constructing log file path: %Rrc\n", rc); + } + else + RTMsgError("RTPathTemp failed when constructing log file path: %Rrc\n", rc); + + if (RT_SUCCESS(rc)) + { + RTUINT fFlags = RTLOGFLAGS_PREFIX_THREAD | RTLOGFLAGS_PREFIX_TIME_PROG; +#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) + fFlags |= RTLOGFLAGS_USECRLF; +#endif + static const char * const g_apszLogGroups[] = VBOX_LOGGROUP_NAMES; + rc = RTLogCreate(&g_pRelLogger, fFlags, "all.e.l", "VBOX_TXS_RELEASE_LOG", + RT_ELEMENTS(g_apszLogGroups), g_apszLogGroups, RTLOGDEST_STDOUT | RTLOGDEST_FILE, szLogFile); + if (RT_SUCCESS(rc)) + { + RTLogRelSetDefaultInstance(g_pRelLogger); + if (g_cVerbose) + { + RTMsgInfo("Setting verbosity logging to level %u\n", g_cVerbose); + switch (g_cVerbose) /* Not very elegant, but has to do it for now. */ + { + case 1: + rc = RTLogGroupSettings(g_pRelLogger, "all.e.l.l2"); + break; + + case 2: + rc = RTLogGroupSettings(g_pRelLogger, "all.e.l.l2.l3"); + break; + + case 3: + rc = RTLogGroupSettings(g_pRelLogger, "all.e.l.l2.l3.l4"); + break; + + case 4: + RT_FALL_THROUGH(); + default: + rc = RTLogGroupSettings(g_pRelLogger, "all.e.l.l2.l3.l4.f"); + break; + } + if (RT_FAILURE(rc)) + RTMsgError("Setting logging groups failed, rc=%Rrc\n", rc); + } + } + else + RTMsgError("Failed to create release logger: %Rrc", rc); + + if (RT_SUCCESS(rc)) + RTMsgInfo("Log file written to '%s'\n", szLogFile); + + LogRel((VBOX_PRODUCT " TestExecService (Validation Kit TxS) Version " VBOX_VERSION_STRING " - r%s\n" + "(C) " VBOX_C_YEAR " " VBOX_VENDOR "\n" + "All rights reserved.\n\n", RTBldCfgRevisionStr())); + } + + /* * Generate a UUID for this TXS instance. */ rc = RTUuidCreate(&g_InstanceUuid); |
