blob: 3d3f30956958a091ca7f70ac4a197c6ad335ff4a [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
Devin Limf5175192018-05-14 19:13:22 -070028// init configuratin to be SR
Devin Limfe9a4cb2018-05-11 17:06:21 -070029fileRelated.init()
Devin Limd1fb8e92018-02-28 16:29:33 -080030funcs.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
You Wang96b98ad2018-05-25 12:14:45 -070038// read the TestON.property depends on which branch it is running. ( currently master on Fabric4, 1.13 on Fabric2 and 1.12 on Fabric3 )
Devin Limd1fb8e92018-02-28 16:29:33 -080039def prop = null
40prop = funcs.getProperties()
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080041SR = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "SR" ]
42
Devin Limf5175192018-05-14 19:13:22 -070043// set the file paths and directory
Devin Limfe9a4cb2018-05-11 17:06:21 -070044graph_generator_file = fileRelated.trendIndividual
45graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric" + funcs.fabricOn( prop[ "ONOSBranch" ] ) + "/"
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080046
Devin Limf5175192018-05-14 19:13:22 -070047// get the list of the tests.
Devin Limd1fb8e92018-02-28 16:29:33 -080048echo( "Testcases:" )
49def testsToRun = null
50testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
51funcs.printTestToRun( testsToRun )
52
Devin Limf5175192018-05-14 19:13:22 -070053// save the functions to run test in the dictionary.
Devin Limd1fb8e92018-02-28 16:29:33 -080054def tests = [:]
55for( String test : SR.keySet() ){
56 toBeRun = testsToRun.contains( test )
57 def stepName = ( toBeRun ? "" : "Not " ) + "Running $test"
58 tests[stepName] = funcs.runTest( test, toBeRun, prop, test, false, SR, graph_generator_file, graph_saved_directory )
59}
60
Devin Limf5175192018-05-14 19:13:22 -070061// get start time
Devin Limd1fb8e92018-02-28 16:29:33 -080062start = funcs.getCurrentTime()
Devin Limf5175192018-05-14 19:13:22 -070063
64// run the tests sequentially
Devin Limd1fb8e92018-02-28 16:29:33 -080065for ( test in tests.keySet() ){
66 tests[ test ].call()
67}
68//funcs.generateOverallGraph( prop, SR, graph_saved_directory )
Devin Limf5175192018-05-14 19:13:22 -070069// send the notification of ending test after SR tests is done.
Devin Limc4054d52018-04-13 18:58:33 -070070funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )