#!groovy
funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )

fileRelated.init()
funcs.initialize( "FUNC" );

// This is a Jenkinsfile for a scripted pipeline for the FUNC tests
def prop = null
prop = funcs.getProperties()
FUNC = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "FUNC" ]

graph_generator_file = fileRelated.trendIndividual
graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"

echo( "Testcases:" )
def testsToRun = null
testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
funcs.printTestToRun( testsToRun )

def tests = [:]
for( String test : FUNC.keySet() ){
    toBeRun = testsToRun.contains( test )
    def stepName = ( toBeRun ? "" : "Not " ) + "Running $test"
    tests[stepName] = funcs.runTest( test, toBeRun, prop, test, false, FUNC, graph_generator_file, graph_saved_directory )
}

start = funcs.getCurrentTime()
// run the tests
for ( test in tests.keySet() ){
    tests[ test ].call()
}
funcs.generateOverallGraph( prop, FUNC, graph_saved_directory )
funcs.sendResultToSlack( start,  prop[ "manualRun" ], prop[ "WikiPrefix" ] )
