Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame^] | 1 | // Copyright 2017 Open Networking Foundation (ONF) |
| 2 | // |
| 3 | // Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 4 | // the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 5 | // or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg> |
| 6 | // |
| 7 | // TestON is free software: you can redistribute it and/or modify |
| 8 | // it under the terms of the GNU General Public License as published by |
| 9 | // the Free Software Foundation, either version 2 of the License, or |
| 10 | // (at your option) any later version. |
| 11 | // |
| 12 | // TestON is distributed in the hope that it will be useful, |
| 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | // GNU General Public License for more details. |
| 16 | // |
| 17 | // You should have received a copy of the GNU General Public License |
| 18 | // along with TestON. If not, see <http://www.gnu.org/licenses/>. |
| 19 | |
| 20 | // This is the Jenkins script for FUNC-pipeline-<branch> |
| 21 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 22 | #!groovy |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame^] | 23 | |
| 24 | // read the dependency files |
Devin Lim | b734ea5 | 2018-05-14 14:13:05 -0700 | [diff] [blame] | 25 | funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' ) |
| 26 | test_lists = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' ) |
| 27 | fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' ) |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 28 | |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame] | 29 | fileRelated.init() |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame^] | 30 | |
| 31 | // initialize the funcs with category of FUNC |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 32 | funcs.initialize( "FUNC" ); |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame] | 33 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 34 | // This is a Jenkinsfile for a scripted pipeline for the FUNC tests |
| 35 | def prop = null |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame^] | 36 | |
| 37 | // Read the TestONOS.property from the VM |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 38 | prop = funcs.getProperties() |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame^] | 39 | |
| 40 | // get the list of the test and init branch to it. |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 41 | FUNC = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "FUNC" ] |
| 42 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame^] | 43 | // init some directories |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame] | 44 | graph_generator_file = fileRelated.trendIndividual |
| 45 | graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/" |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 46 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame^] | 47 | // get the list of the test to run |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 48 | echo( "Testcases:" ) |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 49 | def testsToRun = null |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 50 | testsToRun = funcs.getTestsToRun( prop[ "Tests" ] ) |
| 51 | funcs.printTestToRun( testsToRun ) |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 52 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame^] | 53 | // run the test sequentially and save the function into the dictionary. |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 54 | def tests = [:] |
| 55 | for( String test : FUNC.keySet() ){ |
| 56 | toBeRun = testsToRun.contains( test ) |
| 57 | def stepName = ( toBeRun ? "" : "Not " ) + "Running $test" |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 58 | tests[stepName] = funcs.runTest( test, toBeRun, prop, test, false, FUNC, graph_generator_file, graph_saved_directory ) |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 59 | } |
| 60 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame^] | 61 | // get the start time of the test. |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 62 | start = funcs.getCurrentTime() |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame^] | 63 | |
| 64 | // run the tests sequentially. |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 65 | for ( test in tests.keySet() ){ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 66 | tests[ test ].call() |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 67 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame^] | 68 | |
| 69 | // generate the overall graph of the FUNC tests. |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 70 | funcs.generateOverallGraph( prop, FUNC, graph_saved_directory ) |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame^] | 71 | |
| 72 | // send the notification to Slack that running FUNC tests was ended. |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame] | 73 | funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] ) |