@@ -26,7 +26,7 @@ public void testWithEmptyScript () throws Exception {
26
26
assertBuildStatusSuccess (job .project .scheduleBuild2 (0 ).get ());
27
27
}
28
28
29
- final String SCRIPT_SIMPLE_VARIABLES =
29
+ final static String SCRIPT_SIMPLE_VARIABLES =
30
30
"echo var1=one\n "
31
31
+ "echo var2=two\n "
32
32
+ "echo var3=three" ;
@@ -40,15 +40,14 @@ public void testWithSimpleVariables () throws Exception {
40
40
assertEquals ("three" , vars .get ("var3" ));
41
41
}
42
42
43
- final String SCRIPT_DEPENDENT_VARIABLES =
43
+ final static String SCRIPT_DEPENDENT_VARIABLES =
44
44
"echo var1=one\n "
45
45
+ "echo var2='$var1 two'\n "
46
46
+ "echo var3='yo $var4'\n "
47
47
+ "echo var4='three ${var2}'" ;
48
48
public void testWithDependentVariables () throws Exception {
49
49
TestJob job = new TestJob (SCRIPT_DEPENDENT_VARIABLES );
50
- Build <?, ?> b = assertBuildStatusSuccess (job .project .scheduleBuild2 (0 ).get ());
51
- System .out .println (b .getLog ());
50
+ assertBuildStatusSuccess (job .project .scheduleBuild2 (0 ).get ());
52
51
53
52
EnvVars vars = job .builder .getEnvVars ();
54
53
assertEquals ("one" , vars .get ("var1" ));
@@ -57,14 +56,13 @@ public void testWithDependentVariables () throws Exception {
57
56
assertEquals ("three one two" , vars .get ("var4" ));
58
57
}
59
58
60
- final String SCRIPT_OVERRIDDEN_VARIABLES =
59
+ final static String SCRIPT_OVERRIDDEN_VARIABLES =
61
60
"echo var1=one\n "
62
61
+ "echo var1+something='not one'\n "
63
62
+ "echo var2+something='two'" ;
64
63
public void testWithOverridenVariables () throws Exception {
65
64
TestJob job = new TestJob (SCRIPT_OVERRIDDEN_VARIABLES );
66
- Build <?, ?> b = assertBuildStatusSuccess (job .project .scheduleBuild2 (0 ).get ());
67
- System .out .println (b .getLog ());
65
+ assertBuildStatusSuccess (job .project .scheduleBuild2 (0 ).get ());
68
66
69
67
EnvVars vars = job .builder .getEnvVars ();
70
68
assertEquals ("not one:one" , vars .get ("var1" ));
@@ -78,4 +76,12 @@ public void testReadingFileFromSCM () throws Exception {
78
76
assertBuildStatusSuccess (job .project .scheduleBuild2 (0 ).get ());
79
77
assertEquals ("bar" , job .builder .getEnvVars ().get ("foo_var" ));
80
78
}
81
- }
79
+
80
+ public void testWorkingDirectory () throws Exception {
81
+ TestJob job = new TestJob ("echo hi >was_run" );
82
+ Build <?, ?> build = assertBuildStatusSuccess (job .project .scheduleBuild2 (0 ).get ());
83
+
84
+ // Make sure that the $PWD of the script is $WORKSPACE.
85
+ assertTrue (build .getWorkspace ().child ("was_run" ).exists ());
86
+ }
87
+ }
0 commit comments