Committed by
Gerrit Code Review
Improving stw and adding ability to clean-up mininet properly between runs.
Change-Id: Idb163bfa0cfd13b0ed7b9e4715ca7a2c0ffe69f6
Showing
7 changed files
with
75 additions
and
19 deletions
| ... | @@ -12,15 +12,16 @@ function _ogroup-opts () { | ... | @@ -12,15 +12,16 @@ function _ogroup-opts () { |
| 12 | complete -F _ogroup-opts onos-group | 12 | complete -F _ogroup-opts onos-group |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | -# Tab completion settings for stc | 15 | +# Tab completion settings for stc & stw |
| 16 | function _stc-opts () { | 16 | function _stc-opts () { |
| 17 | local cur=${COMP_WORDS[COMP_CWORD]} | 17 | local cur=${COMP_WORDS[COMP_CWORD]} |
| 18 | - if [ $COMP_CWORD -eq 1 ]; then | 18 | + if [ $COMP_CWORD -ge 1 ]; then |
| 19 | COMPREPLY=( $( compgen -W "$(cd $ONOS_ROOT/tools/test/scenarios && ls -1 | sed 's/.xml//g')" -- $cur ) ) | 19 | COMPREPLY=( $( compgen -W "$(cd $ONOS_ROOT/tools/test/scenarios && ls -1 | sed 's/.xml//g')" -- $cur ) ) |
| 20 | fi | 20 | fi |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | complete -F _stc-opts stc | 23 | complete -F _stc-opts stc |
| 24 | +complete -F _stc-opts stw | ||
| 24 | 25 | ||
| 25 | 26 | ||
| 26 | # Tab completion settings for stl | 27 | # Tab completion settings for stl | ... | ... |
| ... | @@ -66,4 +66,8 @@ stop) | ... | @@ -66,4 +66,8 @@ stop) |
| 66 | $mininet -X "stuff \"^C\\n\"" 2>/dev/null && \ | 66 | $mininet -X "stuff \"^C\\n\"" 2>/dev/null && \ |
| 67 | $mininet -X "stuff \"exit\\n\"" 2>/dev/null | 67 | $mininet -X "stuff \"exit\\n\"" 2>/dev/null |
| 68 | ;; | 68 | ;; |
| 69 | +cleanup) | ||
| 70 | + ssh -t -t $remote sudo mn -c | ||
| 71 | + ssh -t -t $remote "ps -ef | grep 'tail -n1 screenlog.0' | grep -v grep | cut -c10-15 | xargs kill -9" | ||
| 72 | + ;; | ||
| 69 | esac | 73 | esac | ... | ... |
| ... | @@ -3,13 +3,40 @@ | ... | @@ -3,13 +3,40 @@ |
| 3 | # Loops the System Test Coordinator invocations while success/until failure. | 3 | # Loops the System Test Coordinator invocations while success/until failure. |
| 4 | #------------------------------------------------------------------------------- | 4 | #------------------------------------------------------------------------------- |
| 5 | 5 | ||
| 6 | +count=0 | ||
| 7 | +unset doSetup doTeardown | ||
| 8 | + | ||
| 9 | +# Scan arguments for user/password or other options... | ||
| 10 | +while getopts c:st o; do | ||
| 11 | + case "$o" in | ||
| 12 | + c) count=$OPTARG;; | ||
| 13 | + s) doSetup=true;; | ||
| 14 | + t) toTeardown=true;; | ||
| 15 | + esac | ||
| 16 | +done | ||
| 17 | +let OPC=$OPTIND-1 | ||
| 18 | +shift $OPC | ||
| 19 | + | ||
| 20 | +if [ -n "$doSetup" ]; then | ||
| 21 | + printf "Setting up...\n" | ||
| 22 | + stc setup || exit 1 | ||
| 23 | +fi | ||
| 24 | + | ||
| 6 | let run=1 | 25 | let run=1 |
| 7 | -while true; do | 26 | +while [ $count -le 0 -o $run -le $count ]; do |
| 8 | printf "\033]0;%s\007" "STC Run #$run" | 27 | printf "\033]0;%s\007" "STC Run #$run" |
| 9 | printf "Starting run %d...\n" $run | 28 | printf "Starting run %d...\n" $run |
| 10 | - stc "$@" | 29 | + for scenario in "${@:-smoke}"; do |
| 30 | + printf "Running scenario %s...\n" $scenario | ||
| 31 | + stc $scenario | ||
| 32 | + done | ||
| 11 | status=$? | 33 | status=$? |
| 12 | printf "Finished run %d...\n" $run | 34 | printf "Finished run %d...\n" $run |
| 13 | - [ $status -ne 0 ] && break | 35 | + [ $status -ne 0 ] && exit $status |
| 14 | let run=run+1 | 36 | let run=run+1 |
| 15 | done | 37 | done |
| 38 | + | ||
| 39 | +if [ -n "$doTeardown" ]; then | ||
| 40 | + printf "Tearing down...\n" | ||
| 41 | + stc teardown || exit 1 | ||
| 42 | +fi | ... | ... |
| ... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
| 19 | <step name="Push-Topos" exec="onos-push-topos ${OCN}"/> | 19 | <step name="Push-Topos" exec="onos-push-topos ${OCN}"/> |
| 20 | 20 | ||
| 21 | <step name="Stop-Mininet-If-Needed" env="~" exec="onos-mininet stop"/> | 21 | <step name="Stop-Mininet-If-Needed" env="~" exec="onos-mininet stop"/> |
| 22 | + <step name="Clean-Mininet-If-Needed" env="~" exec="onos-mininet cleanup" requires="^"/> | ||
| 22 | <step name="Wipe-Out-Data-Before" exec="onos-wipe-out" requires="^"/> | 23 | <step name="Wipe-Out-Data-Before" exec="onos-wipe-out" requires="^"/> |
| 23 | 24 | ||
| 24 | <step name="Initial-Summary-Check" requires="~Wipe-Out-Data-Before" | 25 | <step name="Initial-Summary-Check" requires="~Wipe-Out-Data-Before" | ... | ... |
| ... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
| 16 | <scenario name="net-setup" description="Network teardown steps"> | 16 | <scenario name="net-setup" description="Network teardown steps"> |
| 17 | <group name="Net-Teardown"> | 17 | <group name="Net-Teardown"> |
| 18 | <step name="Stop-Mininet" exec="onos-mininet stop"/> | 18 | <step name="Stop-Mininet" exec="onos-mininet stop"/> |
| 19 | + <step name="Cleanup-Mininet" exec="onos-mininet cleanup" requires="~Stop-Mininet"/> | ||
| 19 | <XXXstep name="Wipe-Out-Data-After" requires="~Stop-Mininet" exec="onos-wipe-out"/> | 20 | <XXXstep name="Wipe-Out-Data-After" requires="~Stop-Mininet" exec="onos-wipe-out"/> |
| 20 | </group> | 21 | </group> |
| 21 | </scenario> | 22 | </scenario> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
tools/test/scenarios/smoke-internal.xml
0 → 100644
| 1 | +<!-- | ||
| 2 | + ~ Copyright 2016 Open Networking Laboratory | ||
| 3 | + ~ | ||
| 4 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + ~ you may not use this file except in compliance with the License. | ||
| 6 | + ~ You may obtain a copy of the License at | ||
| 7 | + ~ | ||
| 8 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + ~ | ||
| 10 | + ~ Unless required by applicable law or agreed to in writing, software | ||
| 11 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + ~ See the License for the specific language governing permissions and | ||
| 14 | + ~ limitations under the License. | ||
| 15 | + --> | ||
| 16 | +<scenario name="smoke-internal" description="Internals of ONOS smoke test"> | ||
| 17 | + <import file="${ONOS_SCENARIOS}/net-smoke.xml"/> | ||
| 18 | + | ||
| 19 | + <import file="${ONOS_SCENARIOS}/archetypes.xml"/> | ||
| 20 | + <dependency name="Archetypes" requires="~Net-Smoke"/> | ||
| 21 | + | ||
| 22 | + <import file="${ONOS_SCENARIOS}/drivers-test.xml"/> | ||
| 23 | + <dependency name="Drivers-Test" requires="~Net-Smoke,~Archetypes"/> | ||
| 24 | + | ||
| 25 | + <import file="${ONOS_SCENARIOS}/meta-apps-test.xml"/> | ||
| 26 | + <dependency name="Meta-App" requires="~Net-Smoke,~Drivers-Test"/> | ||
| 27 | + | ||
| 28 | + <import file="${ONOS_SCENARIOS}/netcfg.xml"/> | ||
| 29 | + <dependency name="Netcfg" requires="~Meta-App"/> | ||
| 30 | +</scenario> |
| ... | @@ -20,21 +20,13 @@ | ... | @@ -20,21 +20,13 @@ |
| 20 | <import file="${ONOS_SCENARIOS}/setup.xml"/> | 20 | <import file="${ONOS_SCENARIOS}/setup.xml"/> |
| 21 | <dependency name="Setup" requires="Prerequisites,Net-Prerequisites"/> | 21 | <dependency name="Setup" requires="Prerequisites,Net-Prerequisites"/> |
| 22 | 22 | ||
| 23 | - <import file="${ONOS_SCENARIOS}/net-smoke.xml"/> | 23 | + <import file="${ONOS_SCENARIOS}/smoke-internal.xml"/> |
| 24 | <dependency name="Net-Smoke" requires="Setup"/> | 24 | <dependency name="Net-Smoke" requires="Setup"/> |
| 25 | - | 25 | + <dependency name="Archetypes" requires="Setup"/> |
| 26 | - <import file="${ONOS_SCENARIOS}/archetypes.xml"/> | 26 | + <dependency name="Drivers-Test" requires="Setup"/> |
| 27 | - <dependency name="Archetypes" requires="Setup,~Net-Smoke"/> | 27 | + <dependency name="Meta-App" requires="Setup"/> |
| 28 | - | 28 | + <dependency name="Netcfg" requires="Setup"/> |
| 29 | - <import file="${ONOS_SCENARIOS}/drivers-test.xml"/> | ||
| 30 | - <dependency name="Drivers-Test" requires="Setup,~Net-Smoke,~Archetypes"/> | ||
| 31 | - | ||
| 32 | - <import file="${ONOS_SCENARIOS}/meta-apps-test.xml"/> | ||
| 33 | - <dependency name="Meta-App" requires="Setup,~Net-Smoke,~Drivers-Test"/> | ||
| 34 | - | ||
| 35 | - <import file="${ONOS_SCENARIOS}/netcfg.xml"/> | ||
| 36 | - <dependency name="Netcfg" requires="Setup,~Meta-App"/> | ||
| 37 | 29 | ||
| 38 | <import file="${ONOS_SCENARIOS}/wrapup.xml"/> | 30 | <import file="${ONOS_SCENARIOS}/wrapup.xml"/> |
| 39 | - <dependency name="Wrapup" requires="~Archetypes,~Setup,~Net-Smoke,~Drivers-Test,~Meta-App,~Netcfg"/> | 31 | + <dependency name="Wrapup" requires="~Setup,~Net-Smoke,~Archetypes,~Drivers-Test,~Meta-App,~Netcfg"/> |
| 40 | </scenario> | 32 | </scenario> | ... | ... |
-
Please register or login to post a comment