Enhancing STC and scenarios.
Change-Id: I1227e68f8a44707f671b09dcd2967b580e14ca79
Showing
6 changed files
with
52 additions
and
16 deletions
... | @@ -18,28 +18,28 @@ | ... | @@ -18,28 +18,28 @@ |
18 | <step name="Clean-Up" cwd="${WORKSPACE}/tmp" env="~" | 18 | <step name="Clean-Up" cwd="${WORKSPACE}/tmp" env="~" |
19 | exec="rm -r test-app"/> | 19 | exec="rm -r test-app"/> |
20 | 20 | ||
21 | - <step name="Create-App" cwd="${WORKSPACE}/tmp" requires="Clean-Up" | 21 | + <step name="Create-App" cwd="${WORKSPACE}/tmp" requires="^" |
22 | exec="onos-create-app app org.test.app test-app 1.2.3 org.test.app -DinteractiveMode=false"/> | 22 | exec="onos-create-app app org.test.app test-app 1.2.3 org.test.app -DinteractiveMode=false"/> |
23 | <step name="Build-App" requires="Create-App" exec="mvn clean install"/> | 23 | <step name="Build-App" requires="Create-App" exec="mvn clean install"/> |
24 | - <step name="Install-App" requires="Build-App" | 24 | + <step name="Install-App" requires="^" |
25 | exec="onos-app ${OCI} install! target/test-app-1.2.3.oar"/> | 25 | exec="onos-app ${OCI} install! target/test-app-1.2.3.oar"/> |
26 | - <step name="Verify-App" requires="Install-App" | 26 | + <step name="Verify-App" requires="^" |
27 | exec="onos-check-components ${OCI} org.test.app.AppComponent"/> | 27 | exec="onos-check-components ${OCI} org.test.app.AppComponent"/> |
28 | 28 | ||
29 | <step name="Create-App-CLI-Overlay" requires="Install-App" | 29 | <step name="Create-App-CLI-Overlay" requires="Install-App" |
30 | exec="onos-create-app cli org.test.app test-app 1.2.3 org.test.app -DinteractiveMode=false"/> | 30 | exec="onos-create-app cli org.test.app test-app 1.2.3 org.test.app -DinteractiveMode=false"/> |
31 | - <step name="Build-App-With-CLI" requires="Create-App-CLI-Overlay" | 31 | + <step name="Build-App-With-CLI" requires="^" |
32 | exec="mvn clean install"/> | 32 | exec="mvn clean install"/> |
33 | - <step name="Reinstall-App-With-CLI" requires="Build-App-With-CLI,-Verify-App" | 33 | + <step name="Reinstall-App-With-CLI" requires="^,~Verify-App" |
34 | exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/> | 34 | exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/> |
35 | - <step name="Verify-CLI" requires="Reinstall-App-With-CLI" | 35 | + <step name="Verify-CLI" requires="^" |
36 | exec="onos ${OCI} sample"/> | 36 | exec="onos ${OCI} sample"/> |
37 | 37 | ||
38 | <step name="Create-App-UI-Overlay" requires="Reinstall-App-With-CLI" | 38 | <step name="Create-App-UI-Overlay" requires="Reinstall-App-With-CLI" |
39 | exec="onos-create-app ui org.test.app test-app 1.2.3 org.test.app -DinteractiveMode=false"/> | 39 | exec="onos-create-app ui org.test.app test-app 1.2.3 org.test.app -DinteractiveMode=false"/> |
40 | - <step name="Build-App-With-UI" requires="Create-App-UI-Overlay" | 40 | + <step name="Build-App-With-UI" requires="^" |
41 | exec="mvn clean install"/> | 41 | exec="mvn clean install"/> |
42 | - <step name="Reinstall-App-With-UI" requires="Build-App-With-UI,-Verify-CLI" | 42 | + <step name="Reinstall-App-With-UI" requires="^,~Verify-CLI" |
43 | exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/> | 43 | exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/> |
44 | </group> | 44 | </group> |
45 | </scenario> | 45 | </scenario> | ... | ... |
... | @@ -27,11 +27,11 @@ | ... | @@ -27,11 +27,11 @@ |
27 | requires="Install-${#}"/> | 27 | requires="Install-${#}"/> |
28 | 28 | ||
29 | <step name="Check-Logs-${#}" exec="onos-check-logs ${OC#}" | 29 | <step name="Check-Logs-${#}" exec="onos-check-logs ${OC#}" |
30 | - requires="-Wait-for-Start-${#}"/> | 30 | + requires="~Wait-for-Start-${#}"/> |
31 | <step name="Check-Components-${#}" exec="onos-check-components ${OC#}" | 31 | <step name="Check-Components-${#}" exec="onos-check-components ${OC#}" |
32 | - requires="-Wait-for-Start-${#}"/> | 32 | + requires="~Wait-for-Start-${#}"/> |
33 | <step name="Check-Apps-${#}" exec="onos-check-apps ${OC#}" | 33 | <step name="Check-Apps-${#}" exec="onos-check-apps ${OC#}" |
34 | - requires="-Wait-for-Start-${#}"/> | 34 | + requires="~Wait-for-Start-${#}"/> |
35 | </parallel> | 35 | </parallel> |
36 | </group> | 36 | </group> |
37 | </scenario> | 37 | </scenario> | ... | ... |
... | @@ -15,6 +15,13 @@ | ... | @@ -15,6 +15,13 @@ |
15 | --> | 15 | --> |
16 | <scenario name="smoke-test" description="ONOS smoke test"> | 16 | <scenario name="smoke-test" description="ONOS smoke test"> |
17 | <import file="${ONOS_ROOT}/tools/test/scenarios/prerequisites.xml"/> | 17 | <import file="${ONOS_ROOT}/tools/test/scenarios/prerequisites.xml"/> |
18 | + | ||
18 | <import file="${ONOS_ROOT}/tools/test/scenarios/setup.xml"/> | 19 | <import file="${ONOS_ROOT}/tools/test/scenarios/setup.xml"/> |
19 | <dependency name="Setup" requires="Prerequisites"/> | 20 | <dependency name="Setup" requires="Prerequisites"/> |
21 | + | ||
22 | + <import file="${ONOS_ROOT}/tools/test/scenarios/archetypes.xml"/> | ||
23 | + <dependency name="Archetypes" requires="Setup"/> | ||
24 | + | ||
25 | + <import file="${ONOS_ROOT}/tools/test/scenarios/wrapup.xml"/> | ||
26 | + <dependency name="Wrapup" requires="~Archetypes,Setup"/> | ||
20 | </scenario> | 27 | </scenario> | ... | ... |
tools/test/scenarios/wrapup.xml
0 → 100644
1 | +<!-- | ||
2 | + ~ Copyright 2015 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="wrapup" description="ONOS test wrapup"> | ||
17 | + <group name="Wrapup"> | ||
18 | + <parallel var="${OC#}"> | ||
19 | + <step name="Final-Check-Logs-${#}" exec="onos-check-logs ${OC#}"/> | ||
20 | + <step name="Fetch-Logs-${#}" exec="onos-fetch-logs ${OC#}" | ||
21 | + cwd="${WORKSPACE}/tmp/stc" requires="~^"/> | ||
22 | + </parallel> | ||
23 | + </group> | ||
24 | +</scenario> |
... | @@ -73,6 +73,7 @@ public class Compiler { | ... | @@ -73,6 +73,7 @@ public class Compiler { |
73 | private ProcessFlow processFlow; | 73 | private ProcessFlow processFlow; |
74 | private File logDir; | 74 | private File logDir; |
75 | 75 | ||
76 | + private String previous = null; | ||
76 | private String pfx = ""; | 77 | private String pfx = ""; |
77 | private boolean debugOn = System.getenv("debug") != null; | 78 | private boolean debugOn = System.getenv("debug") != null; |
78 | 79 | ||
... | @@ -130,6 +131,7 @@ public class Compiler { | ... | @@ -130,6 +131,7 @@ public class Compiler { |
130 | 131 | ||
131 | /** | 132 | /** |
132 | * Returns the log directory where scenario logs should be kept. | 133 | * Returns the log directory where scenario logs should be kept. |
134 | + * | ||
133 | * @return scenario logs directory | 135 | * @return scenario logs directory |
134 | */ | 136 | */ |
135 | public File logDir() { | 137 | public File logDir() { |
... | @@ -258,6 +260,7 @@ public class Compiler { | ... | @@ -258,6 +260,7 @@ public class Compiler { |
258 | } | 260 | } |
259 | steps.put(step.name(), step); | 261 | steps.put(step.name(), step); |
260 | processRequirements(step, expand(cfg.getString(REQUIRES)), namespace); | 262 | processRequirements(step, expand(cfg.getString(REQUIRES)), namespace); |
263 | + previous = step.name(); | ||
261 | return true; | 264 | return true; |
262 | } | 265 | } |
263 | 266 | ||
... | @@ -317,9 +320,11 @@ public class Compiler { | ... | @@ -317,9 +320,11 @@ public class Compiler { |
317 | * @param namespace optional namespace | 320 | * @param namespace optional namespace |
318 | */ | 321 | */ |
319 | private void processRequirements(Step src, String requires, String namespace) { | 322 | private void processRequirements(Step src, String requires, String namespace) { |
320 | - split(requires).forEach(name -> { | 323 | + split(requires).forEach(n -> { |
321 | - boolean isSoft = name.startsWith("-"); | 324 | + boolean isSoft = n.startsWith("~"); |
322 | - Step dst = getStep(expand(name.replaceFirst("^-", "")), namespace); | 325 | + String name = n.replaceFirst("^~", ""); |
326 | + name = previous != null && name.equals("^") ? previous : name; | ||
327 | + Step dst = getStep(name, namespace); | ||
323 | if (!inactiveSteps.containsValue(dst)) { | 328 | if (!inactiveSteps.containsValue(dst)) { |
324 | dependencies.add(new Dependency(src, dst, isSoft)); | 329 | dependencies.add(new Dependency(src, dst, isSoft)); |
325 | } | 330 | } | ... | ... |
... | @@ -18,13 +18,13 @@ | ... | @@ -18,13 +18,13 @@ |
18 | 18 | ||
19 | <import file="/tmp/junit-stc/two-scenario.xml"/> | 19 | <import file="/tmp/junit-stc/two-scenario.xml"/> |
20 | 20 | ||
21 | - <dependency name="dude" requires="-yolo"/> | 21 | + <dependency name="dude" requires="~yolo"/> |
22 | 22 | ||
23 | <step name="yo" exec="some-command ${HOME} and ${prop.foo} args" if="${prop.foo}"/> | 23 | <step name="yo" exec="some-command ${HOME} and ${prop.foo} args" if="${prop.foo}"/> |
24 | <step name="hi" exec="some-command ${prop.bar} or ${HOME} other args"/> | 24 | <step name="hi" exec="some-command ${prop.bar} or ${HOME} other args"/> |
25 | <step name="there" exec="another-command" requires="yo,hi"/> | 25 | <step name="there" exec="another-command" requires="yo,hi"/> |
26 | 26 | ||
27 | - <step name="maybe" exec="another-command" requires="-hi" unless="${prop.foo}"/> | 27 | + <step name="maybe" exec="another-command" requires="~hi" unless="${prop.foo}"/> |
28 | 28 | ||
29 | <group name="alpha" exec="same-command args" requires="yo"> | 29 | <group name="alpha" exec="same-command args" requires="yo"> |
30 | <step name="one" exec="asdads"/> | 30 | <step name="one" exec="asdads"/> | ... | ... |
-
Please register or login to post a comment