diff --git a/playlet-app/src/manifest b/playlet-app/src/manifest index d5b11485..04ceae45 100644 --- a/playlet-app/src/manifest +++ b/playlet-app/src/manifest @@ -38,4 +38,4 @@ playlet_lib_zip_debug_url=http://DEBUG_HOST_IP_ADDRESS:8086/playlet-lib.zip git_commit_sha=unknown -bs_const=DEBUG=false;DEBUG_FALLBACK_TO_EMBEDDED=true \ No newline at end of file +bs_const=DEBUG=false;TEST_MODE=false;DEBUG_FALLBACK_TO_EMBEDDED=true \ No newline at end of file diff --git a/playlet-app/src/source/Logger.bs b/playlet-app/src/source/Logger.bs index b84fbb5f..5a872b26 100644 --- a/playlet-app/src/source/Logger.bs +++ b/playlet-app/src/source/Logger.bs @@ -35,7 +35,14 @@ namespace Logger msg += `app_state: ${lastExitInfo.app_state}\n` msg += `media_player_state: ${lastExitInfo.media_player_state}\n` msg += `mem_limit: ${lastExitInfo.mem_limit}\n` - msg += `console_log:\n${lastExitInfo.console_log}\n` + + ' Sometimes lastExitInfo.console_log would contain 'AppExitComplete', which + ' is used to detect test runner exits. So we don't log it in test mode. + #if TEST_MODE + #else + msg += `console_log:\n${lastExitInfo.console_log}\n` + #end if + msg += `********** End Last Exit Info **********\n` print msg diff --git a/playlet-lib/src/components/Logger/Logger.bs b/playlet-lib/src/components/Logger/Logger.bs index 852b23d4..7937513c 100644 --- a/playlet-lib/src/components/Logger/Logger.bs +++ b/playlet-lib/src/components/Logger/Logger.bs @@ -59,14 +59,19 @@ function LoggerLoop() DeleteFile(previousLogsFile) MoveFile(logsFile, previousLogsFile) - startUpLogs = ReadAsciiFile(FILENAME_STARTUP) - if not StringUtils.IsNullOrEmpty(startUpLogs) - line = `************* Startup Logs *************\n${startUpLogs}*********** End Startup Logs ***********\n` - print line - buffer.FromAsciiString(line) - buffer.AppendFile(logsFile) - end if - + ' Sometimes lastExitInfo.console_log (which would be contained in startUpLogs) + ' would contain 'AppExitComplete', which is used to detect test runner exits. + ' So we don't log it in test mode. + #if TEST_MODE + #else + startUpLogs = ReadAsciiFile(FILENAME_STARTUP) + if not StringUtils.IsNullOrEmpty(startUpLogs) + line = `************* Startup Logs *************\n${startUpLogs}*********** End Startup Logs ***********\n` + print line + buffer.FromAsciiString(line) + buffer.AppendFile(logsFile) + end if + #end if m.eventThrottleTimer = CreateObject("roTimespan") appMemoryMonitor = CreateObject("roAppMemoryMonitor") diff --git a/playlet-lib/src/manifest b/playlet-lib/src/manifest index 0f7abc24..930debcb 100644 --- a/playlet-lib/src/manifest +++ b/playlet-lib/src/manifest @@ -13,4 +13,4 @@ hidden=1 git_commit_sha=unknown -bs_const=DEBUG=false \ No newline at end of file +bs_const=DEBUG=false;TEST_MODE=false \ No newline at end of file diff --git a/tools/bs-plugins/manifest-edit-plugin.ts b/tools/bs-plugins/manifest-edit-plugin.ts index 37bfe838..87b1e06d 100644 --- a/tools/bs-plugins/manifest-edit-plugin.ts +++ b/tools/bs-plugins/manifest-edit-plugin.ts @@ -42,6 +42,8 @@ export class ManifestEditPlugin implements CompilerPlugin { // Test flag // @ts-ignore const testMode = !!builder.options.testMode; + builder.logger.log(`Setting bs_const TEST_MODE to ${testMode}`) + manifestContent = manifestContent.replace(/TEST_MODE=(true|false)/i, `TEST_MODE=${testMode}`); if (testMode) { builder.logger.log(`Commenting out "sg_component_libs_provided"`) manifestContent = manifestContent.replace(/sg_component_libs_provided=/i, `# sg_component_libs_provided=`);