ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 1 | # Copyright 2008 the V8 project authors. All rights reserved. |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 2 | # Redistribution and use in source and binary forms, with or without |
| 3 | # modification, are permitted provided that the following conditions are |
| 4 | # met: |
| 5 | # |
| 6 | # * Redistributions of source code must retain the above copyright |
| 7 | # notice, this list of conditions and the following disclaimer. |
| 8 | # * Redistributions in binary form must reproduce the above |
| 9 | # copyright notice, this list of conditions and the following |
| 10 | # disclaimer in the documentation and/or other materials provided |
| 11 | # with the distribution. |
| 12 | # * Neither the name of Google Inc. nor the names of its |
| 13 | # contributors may be used to endorse or promote products derived |
| 14 | # from this software without specific prior written permission. |
| 15 | # |
| 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | import sys |
| 29 | from os.path import join, dirname, abspath |
| 30 | root_dir = dirname(File('SConstruct').rfile().abspath) |
| 31 | sys.path.append(join(root_dir, 'tools')) |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 32 | import js2c |
sgjesse@chromium.org | 6db8871 | 2011-07-11 11:41:22 +0000 | [diff] [blame] | 33 | Import('context object_files tools') |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 34 | |
| 35 | |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 36 | # Needed for test-log. Paths are relative to the cctest dir. |
| 37 | JS_FILES_FOR_TESTS = [ |
| 38 | '../../../tools/splaytree.js', |
| 39 | '../../../tools/codemap.js', |
| 40 | '../../../tools/csvparser.js', |
| 41 | '../../../tools/consarray.js', |
| 42 | '../../../tools/profile.js', |
| 43 | '../../../tools/profile_view.js', |
| 44 | '../../../tools/logreader.js', |
| 45 | 'log-eq-of-logging-and-traversal.js', |
| 46 | ] |
| 47 | |
| 48 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 49 | SOURCES = { |
| 50 | 'all': [ |
sgjesse@chromium.org | 720dc0b | 2010-05-10 09:25:39 +0000 | [diff] [blame] | 51 | 'gay-fixed.cc', |
fschneider@chromium.org | c20610a | 2010-09-22 09:44:58 +0000 | [diff] [blame] | 52 | 'gay-precision.cc', |
whesse@chromium.org | cec079d | 2010-03-22 14:44:04 +0000 | [diff] [blame] | 53 | 'gay-shortest.cc', |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 54 | 'test-accessors.cc', |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 55 | 'test-alloc.cc', |
| 56 | 'test-api.cc', |
| 57 | 'test-ast.cc', |
erik.corry@gmail.com | 4a6c327 | 2010-11-18 12:04:40 +0000 | [diff] [blame] | 58 | 'test-bignum-dtoa.cc', |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 59 | 'test-bignum.cc', |
whesse@chromium.org | cec079d | 2010-03-22 14:44:04 +0000 | [diff] [blame] | 60 | 'test-circular-queue.cc', |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 61 | 'test-compiler.cc', |
| 62 | 'test-conversions.cc', |
whesse@chromium.org | cec079d | 2010-03-22 14:44:04 +0000 | [diff] [blame] | 63 | 'test-cpu-profiler.cc', |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 64 | 'test-dataflow.cc', |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 65 | 'test-debug.cc', |
| 66 | 'test-decls.cc', |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 67 | 'test-deoptimization.cc', |
whesse@chromium.org | cec079d | 2010-03-22 14:44:04 +0000 | [diff] [blame] | 68 | 'test-diy-fp.cc', |
| 69 | 'test-double.cc', |
erik.corry@gmail.com | 4a6c327 | 2010-11-18 12:04:40 +0000 | [diff] [blame] | 70 | 'test-dtoa.cc', |
whesse@chromium.org | cec079d | 2010-03-22 14:44:04 +0000 | [diff] [blame] | 71 | 'test-fast-dtoa.cc', |
sgjesse@chromium.org | 720dc0b | 2010-05-10 09:25:39 +0000 | [diff] [blame] | 72 | 'test-fixed-dtoa.cc', |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 73 | 'test-flags.cc', |
kasperl@chromium.org | d1e3e72 | 2009-04-14 13:38:25 +0000 | [diff] [blame] | 74 | 'test-func-name-inference.cc', |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 75 | 'test-hashmap.cc', |
christian.plesner.hansen@gmail.com | 2bc58ef | 2009-09-22 10:00:30 +0000 | [diff] [blame] | 76 | 'test-heap-profiler.cc', |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 77 | 'test-heap.cc', |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 78 | 'test-list.cc', |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 79 | 'test-liveedit.cc', |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 80 | 'test-lock.cc', |
lrn@chromium.org | 1c09276 | 2011-05-09 09:42:16 +0000 | [diff] [blame] | 81 | 'test-lockers.cc', |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 82 | 'test-log.cc', |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 83 | 'test-mark-compact.cc', |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 84 | 'test-parsing.cc', |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 85 | 'test-platform-tls.cc', |
fschneider@chromium.org | 086aac6 | 2010-03-17 13:18:24 +0000 | [diff] [blame] | 86 | 'test-profile-generator.cc', |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 87 | 'test-regexp.cc', |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 88 | 'test-reloc-info.cc', |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 89 | 'test-serialize.cc', |
| 90 | 'test-sockets.cc', |
| 91 | 'test-spaces.cc', |
| 92 | 'test-strings.cc', |
ager@chromium.org | b61a0d1 | 2010-10-13 08:35:23 +0000 | [diff] [blame] | 93 | 'test-strtod.cc', |
sgjesse@chromium.org | c81c894 | 2009-08-21 10:54:26 +0000 | [diff] [blame] | 94 | 'test-thread-termination.cc', |
lrn@chromium.org | 32d961d | 2010-06-30 09:09:34 +0000 | [diff] [blame] | 95 | 'test-threads.cc', |
kmillikin@chromium.org | 9155e25 | 2010-05-26 13:27:57 +0000 | [diff] [blame] | 96 | 'test-unbound-queue.cc', |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 97 | 'test-utils.cc', |
| 98 | 'test-version.cc' |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 99 | ], |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 100 | 'arch:arm': [ |
| 101 | 'test-assembler-arm.cc', |
| 102 | 'test-disasm-arm.cc' |
| 103 | ], |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 104 | 'arch:ia32': [ |
| 105 | 'test-assembler-ia32.cc', |
| 106 | 'test-disasm-ia32.cc', |
sgjesse@chromium.org | b9d7da1 | 2009-08-05 08:38:10 +0000 | [diff] [blame] | 107 | 'test-log-stack-tracer.cc' |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 108 | ], |
christian.plesner.hansen@gmail.com | 9d58c2b | 2009-10-16 11:48:38 +0000 | [diff] [blame] | 109 | 'arch:x64': ['test-assembler-x64.cc', |
| 110 | 'test-macro-assembler-x64.cc', |
| 111 | 'test-log-stack-tracer.cc'], |
karlklose@chromium.org | 83a4728 | 2011-05-11 11:54:09 +0000 | [diff] [blame] | 112 | 'arch:mips': ['test-assembler-mips.cc', |
| 113 | 'test-disasm-mips.cc'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 114 | 'os:linux': ['test-platform-linux.cc'], |
| 115 | 'os:macos': ['test-platform-macos.cc'], |
| 116 | 'os:nullos': ['test-platform-nullos.cc'], |
| 117 | 'os:win32': ['test-platform-win32.cc'] |
| 118 | } |
| 119 | |
| 120 | |
| 121 | def Build(): |
| 122 | cctest_files = context.GetRelevantSources(SOURCES) |
sgjesse@chromium.org | 6db8871 | 2011-07-11 11:41:22 +0000 | [diff] [blame] | 123 | env = Environment(tools=tools) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 124 | env.Replace(**context.flags['cctest']) |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 125 | context.ApplyEnvOverrides(env) |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 126 | env['BUILDERS']['JS2C'] = Builder(action=js2c.JS2C) |
| 127 | |
| 128 | # Combine the JavaScript library files into a single C++ file and |
| 129 | # compile it. |
| 130 | js_files = [s for s in JS_FILES_FOR_TESTS] |
| 131 | js_files_src = env.JS2C( |
| 132 | ['js-files-for-cctest.cc'], js_files, **{'TYPE': 'TEST', 'COMPRESSION': 'off'}) |
| 133 | js_files_obj = context.ConfigureObject(env, js_files_src, CPPPATH=['.']) |
| 134 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 135 | # There seems to be a glitch in the way scons decides where to put |
| 136 | # PDB files when compiling using MSVC so we specify it manually. |
| 137 | # This should not affect any other platforms. |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 138 | object_files.append(js_files_obj) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 139 | return env.Program('cctest', ['cctest.cc', cctest_files, object_files], |
| 140 | PDB='cctest.exe.pdb') |
| 141 | |
| 142 | |
| 143 | program = Build() |
| 144 | Return('program') |