OLD | NEW |
| (Empty) |
1 #! -*- python -*- | |
2 # | |
3 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 | |
7 '''Build file for building the VSX plugin and running its test projects.''' | |
8 | |
9 import os | |
10 import sys | |
11 | |
12 Import('env') | |
13 | |
14 # Check to ensure that we're running on windows. | |
15 if not env['IS_WINDOWS']: | |
16 Return() | |
17 | |
18 # Add the system path to this environment so that we can run gclient and such | |
19 env.AppendENVPath('PATH', os.environ['PATH']) | |
20 | |
21 # Duplicate all the shell environment variables, so that various Visual Studio | |
22 # tools will have the variables they expect (e.g. VS 2008 needs VS90COMNTOOLS). | |
23 # Do this using "if not in" instead of update(), so that os.environ variables | |
24 # don't override variables in env['ENV']. | |
25 for shell_var in os.environ: | |
26 if shell_var not in env['ENV']: | |
27 env['ENV'][shell_var] = os.environ[shell_var] | |
28 | |
29 vsx_root_path = os.path.join( | |
30 env['ROOT_DIR'], 'experimental', 'visual_studio_plugin') | |
31 env['ENV']['NACL_VSX_ROOT'] = vsx_root_path | |
32 env['ENV']['NACL_SDK_ROOT'] = env['ROOT_DIR'] | |
33 | |
34 nacl_vsx_solution = os.path.join(vsx_root_path, 'build', 'NativeClientVSX.sln') | |
35 vsx_build_all_command = env.BuildVSSolution('vsx', nacl_vsx_solution) | |
36 | |
37 env.Depends(vsx_build_all_command, env.GetToolchainNode()) | |
38 | |
39 def DefineVSTestSet(package_name, type, size): | |
40 '''Defines a set of tests to be added to the scons test set. | |
41 | |
42 This function accepts a package name and the type and test size and creates | |
43 a testing target that can be run as part of the build. The target is added | |
44 to the bot and the appropriate test size targets, and an individual target | |
45 for the test set is created as well. | |
46 | |
47 Arguments: | |
48 package - The name of the VS package whose test package should be added to | |
49 the build. | |
50 type - The type test package to expect as a string. This can be 'dll' or | |
51 'exe'. | |
52 size - Which test harness to add the tests to; small, medium, or large | |
53 ''' | |
54 unit_test_name = '%s_UnitTestProject' % package_name | |
55 test_container = os.path.join(vsx_root_path, 'src', package_name, | |
56 unit_test_name, 'bin', 'Debug', | |
57 '%s.%s' % (unit_test_name, type)) | |
58 env.TestVSSolution(target_name=('run_%s_tests' % package_name), | |
59 test_container=test_container, | |
60 type=type, | |
61 size=size, | |
62 build_cmd=vsx_build_all_command) | |
63 | |
64 DefineVSTestSet('NaClVsx.Package', 'dll', 'small') | |
65 DefineVSTestSet('MsAd7.BaseImpl', 'dll', 'small') | |
66 DefineVSTestSet('dwarf_reader', 'exe', 'small') | |
OLD | NEW |