1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-30 15:13:57 +00:00

1. Removed commented out code

2. Updated self test to work in service mode
This commit is contained in:
Bryan Roe
2020-08-12 00:06:31 -07:00
parent 9a8641b959
commit c56ab5574f
2 changed files with 40 additions and 19 deletions

View File

@@ -3687,22 +3687,6 @@ void MeshServer_Agent_SelfTest(MeshAgentHostContainer *agent)
free(CoreModule);
}
//printf(" -> Loading Test Script from db ...");
//if (CoreModuleTesterLen == 0)
//{
// printf("[NOT FOUND]\n");
// return;
//}
//ILibMemory_AllocateRaw(CoreModuleTester, CoreModuleTesterLen);
//ILibSimpleDataStore_Get(agent->masterDb, "CoreModuleTester", CoreModuleTester, CoreModuleTesterLen);
//if (ILibDuktape_ModSearch_AddModule(agent->meshCoreCtx, "meshcore-test", CoreModuleTester, (int)CoreModuleTesterLen) != 0)
//{
// printf("[ERROR]\n");
// return;
//}
//printf("[OK]\n");
if (duk_peval_string(agent->meshCoreCtx, "require('agent-selftest')();") != 0)
{
printf(" -> Loading Test Script.................[FAILED]\n");

View File

@@ -44,8 +44,23 @@ var promise = require('promise');
function start()
{
console.log('\nStarting Self Test...');
var isservice = false;
var service = null;
try
{
service = require('service-manager').manager.getService(process.platform == 'win32' ? 'Mesh Agent' : 'meshagent');
isservice = service.isMe();
}
catch(e)
{
}
if (isservice)
{
console.setDestination(console.Destinations.LOGFILE);
}
console.log('Starting Self Test...');
coreInfo()
.then(function () { return (testLMS()); })
.then(function () { return (testConsoleHelp()); })
@@ -54,8 +69,30 @@ function start()
.then(function () { return (testTerminal()); })
.then(function () { return (testKVM()); })
.then(function () { return (testFileDownload()); })
.then(function () { console.log('End of Self Test'); })
.catch(function (v) { console.log(v); });
.then(function ()
{
console.log('End of Self Test');
if (isservice)
{
service.stop();
}
else
{
process._exit();
}
})
.catch(function (v)
{
console.log(v);
if (isservice)
{
service.stop();
}
else
{
process._exit();
}
});
}
function getFDSnapshot()