blob: 9b85b89de3dc536b615ab9600c55beacccb0c173 [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 SR-pipeline-<branch>
22
Devin Limf5175192018-05-14 19:13:22 -070023// read dependencies.
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
Jon Hall2ee92f82018-06-07 13:07:33 -070028// init configuration to be SR
Devin Limfe9a4cb2018-05-11 17:06:21 -070029fileRelated.init()
Jon Hall2ee92f82018-06-07 13:07:33 -070030funcs.initialize( "SR" )
Devin Limf5175192018-05-14 19:13:22 -070031
32// get the name of the Jenkins job.
Devin Lim35df4e62018-04-06 17:58:58 -070033jobName = env.JOB_NAME
Devin Limf5175192018-05-14 19:13:22 -070034
35// additional setup for Segment routing because it is running multiple branch concurrently on different machines.
Devin Limc4054d52018-04-13 18:58:33 -070036funcs.additionalInitForSR( jobName )
Devin Limf5175192018-05-14 19:13:22 -070037
Jon Hall6af749d2018-05-29 12:59:47 -070038// read the TestON.property depends on which branch it is running.
You Wangdba6c9f2018-12-21 11:58:55 -080039// ( currently master on Fabric4, 1.15 on Fabric2 and 2.0 on Fabric3 )
Devin Limd1fb8e92018-02-28 16:29:33 -080040def prop = null
41prop = funcs.getProperties()
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080042SR = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "SR" ]
43
Devin Limf5175192018-05-14 19:13:22 -070044// set the file paths and directory
Devin Limfe9a4cb2018-05-11 17:06:21 -070045graph_generator_file = fileRelated.trendIndividual
46graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric" + funcs.fabricOn( prop[ "ONOSBranch" ] ) + "/"
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080047
Devin Limf5175192018-05-14 19:13:22 -070048// get the list of the tests.
Devin Limd1fb8e92018-02-28 16:29:33 -080049echo( "Testcases:" )
50def testsToRun = null
51testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
52funcs.printTestToRun( testsToRun )
53
Devin Limf5175192018-05-14 19:13:22 -070054// save the functions to run test in the dictionary.
Jon Hall6af749d2018-05-29 12:59:47 -070055def tests = [ : ]
56for ( String test : SR.keySet() ){
Devin Limd1fb8e92018-02-28 16:29:33 -080057 toBeRun = testsToRun.contains( test )
58 def stepName = ( toBeRun ? "" : "Not " ) + "Running $test"
Jon Hall845f5922018-06-14 12:34:42 -070059 def pureTestName = ( SR[ test ].containsKey( "test" ) ? SR[ test ][ "test" ].split().head() : test )
Jon Halle5da90a2018-06-14 12:26:00 -070060 tests[ stepName ] = funcs.runTest( test, toBeRun, prop, pureTestName, false,
Jon Hall6af749d2018-05-29 12:59:47 -070061 SR, graph_generator_file, graph_saved_directory )
Devin Limd1fb8e92018-02-28 16:29:33 -080062}
63
Devin Limf5175192018-05-14 19:13:22 -070064// get start time
Devin Limd1fb8e92018-02-28 16:29:33 -080065start = funcs.getCurrentTime()
Devin Limf5175192018-05-14 19:13:22 -070066
67// run the tests sequentially
Devin Limd1fb8e92018-02-28 16:29:33 -080068for ( test in tests.keySet() ){
69 tests[ test ].call()
70}
71//funcs.generateOverallGraph( prop, SR, graph_saved_directory )
Devin Limf5175192018-05-14 19:13:22 -070072// send the notification of ending test after SR tests is done.
Jon Hall6af749d2018-05-29 12:59:47 -070073funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )