updated copyright and added csv results output to bench.py
[scons.git] / test / Java / JAVABOOTCLASSPATH.py
blobd5ccc09d79791baa5984d73c6c3a8ce855f3c166
1 #!/usr/bin/env python
3 # MIT License
5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 """
27 Verify that use of $JAVABOOTCLASSPATH sets the -bootclasspath option
28 on javac compilations.
29 """
31 import os
33 import TestSCons
35 test = TestSCons.TestSCons()
37 where_javac, java_version = test.java_where_javac()
39 test.write('SConstruct', """
40 DefaultEnvironment(tools=[])
41 env = Environment(tools=['javac'], JAVABOOTCLASSPATH=['dir1', 'dir2'])
42 j1 = env.Java(target='class', source='com/Example1.java')
43 j2 = env.Java(target='class', source='com/Example2.java')
44 """)
46 test.subdir('com')
48 test.write(['com', 'Example1.java'], """\
49 package com;
51 public class Example1
54 public static void main(String[] args)
60 """)
62 test.write(['com', 'Example2.java'], """\
63 package com;
65 public class Example2
68 public static void main(String[] args)
74 """)
76 # Setting -bootclasspath messes with the Java runtime environment, so
77 # we'll just take the easy way out and examine the -n output to see if
78 # the expected option shows up on the command line.
80 bootclasspath = os.pathsep.join(['dir1', 'dir2'])
82 expect = """\
83 javac -bootclasspath %(bootclasspath)s -d class -sourcepath com com.Example1\\.java
84 javac -bootclasspath %(bootclasspath)s -d class -sourcepath com com.Example2\\.java
85 """ % locals()
87 test.run(arguments = '-Q -n .', stdout = expect, match=TestSCons.match_re)
89 test.pass_test()
91 # Local Variables:
92 # tab-width:4
93 # indent-tabs-mode:nil
94 # End:
95 # vim: set expandtab tabstop=4 shiftwidth=4: