blob: 3bcd47e38579eea453dff6b2d544535cdbc05ec9 [file] [log] [blame]
Devin Lime1346f42018-05-15 15:41:36 -07001#!groovy
Devin Limf5175192018-05-14 19:13:22 -07002// Copyright 2017 Open Networking Foundation (ONF)
3//
4// Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5// the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6// or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
7//
8// TestON is free software: you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation, either version 2 of the License, or
11// (at your option) any later version.
12//
13// TestON is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with TestON. If not, see <http://www.gnu.org/licenses/>.
20
21// This is the Jenkins script for FUNC-pipeline-<branch>
22
Devin Limf5175192018-05-14 19:13:22 -070023// read the dependency files
Devin Limb734ea52018-05-14 14:13:05 -070024funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
25test_lists = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' )
26fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080027
Devin Limfe9a4cb2018-05-11 17:06:21 -070028fileRelated.init()
Devin Limf5175192018-05-14 19:13:22 -070029
30// initialize the funcs with category of FUNC
Devin Lim61643762017-12-07 15:55:38 -080031funcs.initialize( "FUNC" );
Devin Limfe9a4cb2018-05-11 17:06:21 -070032
Devin Lim90803a82017-08-29 13:41:44 -070033// This is a Jenkinsfile for a scripted pipeline for the FUNC tests
34def prop = null
Devin Limf5175192018-05-14 19:13:22 -070035
36// Read the TestONOS.property from the VM
Devin Lim61643762017-12-07 15:55:38 -080037prop = funcs.getProperties()
Devin Limf5175192018-05-14 19:13:22 -070038
39// get the list of the test and init branch to it.
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080040FUNC = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "FUNC" ]
41
Devin Limf5175192018-05-14 19:13:22 -070042// init some directories
Devin Limfe9a4cb2018-05-11 17:06:21 -070043graph_generator_file = fileRelated.trendIndividual
44graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080045
Devin Limf5175192018-05-14 19:13:22 -070046// get the list of the test to run
Devin Lim61643762017-12-07 15:55:38 -080047echo( "Testcases:" )
Devin Lim90803a82017-08-29 13:41:44 -070048def testsToRun = null
Devin Lim61643762017-12-07 15:55:38 -080049testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
50funcs.printTestToRun( testsToRun )
Devin Lim90803a82017-08-29 13:41:44 -070051
Devin Limf5175192018-05-14 19:13:22 -070052// run the test sequentially and save the function into the dictionary.
Jon Hall6af749d2018-05-29 12:59:47 -070053def tests = [ : ]
54for ( String test : FUNC.keySet() ){
55 def toBeRun = testsToRun.contains( test )
Devin Lim90803a82017-08-29 13:41:44 -070056 def stepName = ( toBeRun ? "" : "Not " ) + "Running $test"
Jon Hall845f5922018-06-14 12:34:42 -070057 def pureTestName = ( FUNC[ test ].containsKey( "test" ) ? FUNC[ test ][ "test" ].split().head() : test )
Jon Hall8b1e92c2018-06-13 14:07:22 -070058 tests[ stepName ] = funcs.runTest( test, toBeRun, prop, pureTestName, false,
Jon Hall6af749d2018-05-29 12:59:47 -070059 FUNC, graph_generator_file, graph_saved_directory )
Devin Lim90803a82017-08-29 13:41:44 -070060}
61
Devin Limf5175192018-05-14 19:13:22 -070062// get the start time of the test.
Devin Lim61643762017-12-07 15:55:38 -080063start = funcs.getCurrentTime()
Devin Limf5175192018-05-14 19:13:22 -070064
65// run the tests sequentially.
Devin Lim90803a82017-08-29 13:41:44 -070066for ( test in tests.keySet() ){
Devin Lim61643762017-12-07 15:55:38 -080067 tests[ test ].call()
Devin Lim90803a82017-08-29 13:41:44 -070068}
Devin Limf5175192018-05-14 19:13:22 -070069
70// generate the overall graph of the FUNC tests.
Devin Lim61643762017-12-07 15:55:38 -080071funcs.generateOverallGraph( prop, FUNC, graph_saved_directory )
Devin Limf5175192018-05-14 19:13:22 -070072
73// send the notification to Slack that running FUNC tests was ended.
Jon Hall6af749d2018-05-29 12:59:47 -070074funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )