Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # -*- python -*- | 1 # -*- python -*- |
| 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import platform | 6 import platform |
| 7 import os | 7 import os |
| 8 | 8 |
| 9 Import('env') | 9 Import('env') |
| 10 | 10 |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 547 env.AddNodeToTestSuite(node, ['small_tests'], 'run_format_string_test') | 547 env.AddNodeToTestSuite(node, ['small_tests'], 'run_format_string_test') |
| 548 | 548 |
| 549 | 549 |
| 550 if env.Bit('target_x86_32'): | 550 if env.Bit('target_x86_32'): |
| 551 arch_testdata_dir = 'testdata/x86_32' | 551 arch_testdata_dir = 'testdata/x86_32' |
| 552 elif env.Bit('target_x86_64'): | 552 elif env.Bit('target_x86_64'): |
| 553 arch_testdata_dir = 'testdata/x86_64' | 553 arch_testdata_dir = 'testdata/x86_64' |
| 554 else: | 554 else: |
| 555 arch_testdata_dir = 'testdata/' + env['TARGET_ARCHITECTURE'] | 555 arch_testdata_dir = 'testdata/' + env['TARGET_ARCHITECTURE'] |
| 556 | 556 |
| 557 if not env.Bit('bitcode') or env.Bit('target_mips32'): | |
|
Mark Seaborn
2013/10/15 23:38:45
Why would this work for env.Bit('target_mips32') b
petarj
2013/10/16 00:24:37
This is a workaround to the issue with NO-NATIVE-C
| |
| 558 untrusted_env = env.MakeUntrustedNativeEnv() | |
| 559 hello_world_src = env.File('${MAIN_DIR}/tests/hello_world/hello_world.c') | |
| 560 hello_world_obj = untrusted_env.ComponentObject('hello_world', | |
| 561 hello_world_src) | |
| 562 hello_world_nexe = untrusted_env.ComponentProgram( | |
|
Mark Seaborn
2013/10/15 23:38:45
Can you do:
untrusted_env.File('$STAGING_DIR/hello
petarj
2013/10/16 23:36:08
Done.
| |
| 563 'hello_world', | |
| 564 hello_world_obj, | |
| 565 EXTRA_LIBS=['${NONIRT_LIBS}']) | |
| 557 | 566 |
| 558 # Doesn't work on windows under coverage. | 567 # Doesn't work on windows under coverage. |
| 559 # TODO(bradnelson): fix this to work on windows under coverage. | 568 # TODO(bradnelson): fix this to work on windows under coverage. |
| 560 if not env.Bit('windows') or not env.Bit('coverage_enabled'): | 569 if ((not env.Bit('windows') or not env.Bit('coverage_enabled')) and |
| 570 (not env.Bit('bitcode') or env.Bit('target_mips32'))): | |
| 561 # NOTE: uses validator | 571 # NOTE: uses validator |
| 562 mmap_test_objs = [env.ComponentObject('mmap_test.c')] | 572 mmap_test_objs = [env.ComponentObject('mmap_test.c')] |
| 563 mmap_test_exe = env.ComponentProgram( | 573 mmap_test_exe = env.ComponentProgram( |
| 564 'mmap_test', | 574 'mmap_test', |
| 565 mmap_test_objs, | 575 mmap_test_objs, |
| 566 EXTRA_LIBS=['sel', | 576 EXTRA_LIBS=['sel', |
| 567 'env_cleanser', | 577 'env_cleanser', |
| 568 'manifest_proxy', | 578 'manifest_proxy', |
| 569 'simple_service', | 579 'simple_service', |
| 570 'thread_interface', | 580 'thread_interface', |
| 571 'gio_wrapped_desc', | 581 'gio_wrapped_desc', |
| 572 'nonnacl_srpc', | 582 'nonnacl_srpc', |
| 573 'nrd_xfer', | 583 'nrd_xfer', |
| 574 'nacl_perf_counter', | 584 'nacl_perf_counter', |
| 575 'nacl_base', | 585 'nacl_base', |
| 576 'imc', | 586 'imc', |
| 577 'nacl_fault_inject', | 587 'nacl_fault_inject', |
| 578 'nacl_interval', | 588 'nacl_interval', |
| 579 'platform', | 589 'platform', |
| 580 'sel_test', | 590 'sel_test', |
| 581 ]) | 591 ]) |
| 582 | 592 |
| 583 mmap_test_file = env.File(arch_testdata_dir + '/hello_world.nexe') | 593 if env.Bit('nacl_glibc'): |
| 584 mmap_test_command = env.AddBootstrap(mmap_test_exe, [mmap_test_file]) | 594 mmap_test_args = ['%s/runnable-ld.so' % (untrusted_env['NACL_SDK_LIB'])] |
| 595 mmap_test_args = mmap_test_args + [hello_world_nexe] | |
|
Mark Seaborn
2013/10/15 23:38:45
This is kind of misleading: since this test wouldn
petarj
2013/10/16 23:36:08
Done.
| |
| 596 else: | |
| 597 mmap_test_args = [hello_world_nexe] | |
| 598 | |
| 599 mmap_test_command = env.AddBootstrap(mmap_test_exe, mmap_test_args) | |
| 585 | 600 |
| 586 # TODO(robertm): This test emits lots of messages to stderr | 601 # TODO(robertm): This test emits lots of messages to stderr |
| 587 node = env.CommandTest ( | 602 node = env.CommandTest ( |
| 588 "mmap_test.out", | 603 "mmap_test.out", |
| 589 command=mmap_test_command, | 604 command=mmap_test_command, |
| 590 # TODO(mseaborn): Extend this test to cover the case where the | 605 # TODO(mseaborn): Extend this test to cover the case where the |
| 591 # dynamic code segment is present. | 606 # dynamic code segment is present. |
| 592 osenv='NACL_DISABLE_DYNAMIC_LOADING=1') | 607 osenv='NACL_DISABLE_DYNAMIC_LOADING=1') |
| 593 env.AddNodeToTestSuite(node, ['medium_tests'], 'run_trusted_mmap_test') | 608 env.AddNodeToTestSuite(node, ['medium_tests'], 'run_trusted_mmap_test') |
| 594 | 609 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 794 # Test that sel_ldr does not crash if the executable file cannot be opened. | 809 # Test that sel_ldr does not crash if the executable file cannot be opened. |
| 795 node = env.CommandSelLdrTestNacl( | 810 node = env.CommandSelLdrTestNacl( |
| 796 'sel_ldr_exe_not_found.out', | 811 'sel_ldr_exe_not_found.out', |
| 797 'name_of_file_that_does_not_exist.nexe', | 812 'name_of_file_that_does_not_exist.nexe', |
| 798 exit_status='1') | 813 exit_status='1') |
| 799 env.AddNodeToTestSuite(node, ['small_tests'], 'run_sel_ldr_exe_not_found_test') | 814 env.AddNodeToTestSuite(node, ['small_tests'], 'run_sel_ldr_exe_not_found_test') |
| 800 | 815 |
| 801 # Check that "-F" makes sel_ldr stop after loading the nexe but before running | 816 # Check that "-F" makes sel_ldr stop after loading the nexe but before running |
| 802 # it. | 817 # it. |
| 803 if not env.Bit('bitcode') or env.Bit('target_mips32'): | 818 if not env.Bit('bitcode') or env.Bit('target_mips32'): |
| 804 untrusted_env = env.MakeUntrustedNativeEnv() | |
| 805 nullptr_src = env.File('${MAIN_DIR}/tests/nullptr/nullptr.c') | 819 nullptr_src = env.File('${MAIN_DIR}/tests/nullptr/nullptr.c') |
| 806 nullptr_obj = untrusted_env.ComponentObject('nullptr', nullptr_src) | 820 nullptr_obj = untrusted_env.ComponentObject('nullptr', nullptr_src) |
| 807 nullptr_nexe = untrusted_env.ComponentProgram('nullptr', nullptr_obj) | 821 nullptr_nexe = untrusted_env.ComponentProgram('nullptr', nullptr_obj) |
| 808 | 822 |
| 809 node = env.CommandSelLdrTestNacl( | 823 node = env.CommandSelLdrTestNacl( |
| 810 'fuzz_nullptr_test.out', | 824 'fuzz_nullptr_test.out', |
| 811 nullptr_nexe, | 825 nullptr_nexe, |
| 812 sel_ldr_flags=['-F']) | 826 sel_ldr_flags=['-F']) |
| 813 env.AddNodeToTestSuite(node, ['small_tests'], 'run_fuzz_nullptr_test') | 827 env.AddNodeToTestSuite(node, ['small_tests'], 'run_fuzz_nullptr_test') |
| 814 | 828 |
| 815 # ---------------------------------------------------------- | 829 # Test hello_world binary with obsolete, non-ragel based validator. |
| 816 # Small tests with canned binaries | 830 if (not env.Bit('validator_ragel') and env.Bit('target_x86') and |
| 817 # ---------------------------------------------------------- | 831 not env.Bit('bitcode')): |
| 818 | 832 node = untrusted_env.CommandSelLdrTestNacl( |
| 819 if env.Bit('target_x86_64'): | |
| 820 node = env.CommandSelLdrTestNacl( | |
| 821 'hello_x32.out', | |
| 822 env.File(os.path.join(arch_testdata_dir, 'hello_x32.nexe')), | |
| 823 stdout_golden=env.File(os.path.join('${MAIN_DIR}', | |
| 824 'tests/hello_world', | |
| 825 'hello_world.stdout')) | |
| 826 ) | |
| 827 env.AddNodeToTestSuite(node, ['small_tests'], 'run_hello_x32_test') | |
| 828 | |
| 829 # Test canned hello_world binary with obsolete, non-ragel based validator. | |
| 830 if not env.Bit('validator_ragel') and env.Bit('target_x86'): | |
| 831 node = env.CommandSelLdrTestNacl( | |
| 832 'dfa_hwd.out', | 833 'dfa_hwd.out', |
| 833 env.File(arch_testdata_dir + '/hello_world.nexe'), | 834 hello_world_nexe, |
| 834 stdout_golden = env.File('testdata/hello_world.stdout'), | 835 stdout_golden = env.File('testdata/hello_world.stdout'), |
| 835 stderr_golden = env.File('testdata/non_dfa_validator_hello.stderr'), | 836 stderr_golden = env.File('testdata/non_dfa_validator_hello.stderr'), |
| 836 filter_regex = '"^(Hello, World!)$' + '|' + | 837 filter_regex = '"^(Hello, World!)$' + '|' + |
| 837 '^[[][^]]*[]] (USING OBSOLETE NON-DFA-BASED VALIDATOR!)$"', | 838 '^[[][^]]*[]] (USING OBSOLETE NON-DFA-BASED VALIDATOR!)$"', |
| 838 filter_group_only = 'true', | 839 filter_group_only = 'true', |
| 839 ) | 840 ) |
| 840 env.AddNodeToTestSuite(node, ['medium_tests', 'validator_tests'], | 841 env.AddNodeToTestSuite(node, ['medium_tests', 'validator_tests'], |
| 841 'run_dfa_validator_hello_world_test') | 842 'run_dfa_validator_hello_world_test') |
| 842 | 843 |
| 843 if env.Bit('target_mips32'): | 844 if env.Bit('target_mips32'): |
| 844 text_region_start = 0x00020000 | 845 text_region_start = 0x00020000 |
| 845 # Use arbitrary non-page-aligned addresses for data and rodata. | 846 # Use arbitrary non-page-aligned addresses for data and rodata. |
| 846 rodata_region_start = 0x10020094 | 847 rodata_region_start = 0x10020094 |
| 847 data_region_start = 0x10030098 | 848 data_region_start = 0x10030098 |
| 848 untrusted_env = env.MakeUntrustedNativeEnv() | |
|
Mark Seaborn
2013/10/15 23:38:45
Better to leave this in. Otherwise you're relying
petarj
2013/10/16 23:36:08
untrusted_env is not assigned under condition anym
| |
| 849 untrusted_env.Append(CPPFLAGS=['--pnacl-allow-native', '-arch', 'mips32']) | 849 untrusted_env.Append(CPPFLAGS=['--pnacl-allow-native', '-arch', 'mips32']) |
| 850 unaligned_data_objs = untrusted_env.ComponentObject( | 850 unaligned_data_objs = untrusted_env.ComponentObject( |
| 851 'arch/mips/unaligned_data_test.S') | 851 'arch/mips/unaligned_data_test.S') |
| 852 unaligned_data_nexe = untrusted_env.ComponentProgram( | 852 unaligned_data_nexe = untrusted_env.ComponentProgram( |
| 853 'unaligned_data.nexe', | 853 'unaligned_data.nexe', |
| 854 unaligned_data_objs, | 854 unaligned_data_objs, |
| 855 LINKFLAGS=['-nostdlib', | 855 LINKFLAGS=['-nostdlib', |
| 856 '--pnacl-allow-native', '-arch', 'mips32', | 856 '--pnacl-allow-native', '-arch', 'mips32', |
| 857 '-Wn,--section-start=.text=0x%x' % (text_region_start), | 857 '-Wn,--section-start=.text=0x%x' % (text_region_start), |
| 858 '-Wn,--section-start=.rodata=0x%x' % (rodata_region_start), | 858 '-Wn,--section-start=.rodata=0x%x' % (rodata_region_start), |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 880 env.AddNodeToTestSuite(node, ['small_tests'], 'run_unaligned_data_test') | 880 env.AddNodeToTestSuite(node, ['small_tests'], 'run_unaligned_data_test') |
| 881 | 881 |
| 882 node = env.CommandSelLdrTestNacl( | 882 node = env.CommandSelLdrTestNacl( |
| 883 'unaligned_data_irt.out', | 883 'unaligned_data_irt.out', |
| 884 unaligned_data_nexe, | 884 unaligned_data_nexe, |
| 885 sel_ldr_flags=['-B', unaligned_data_irt_nexe] | 885 sel_ldr_flags=['-B', unaligned_data_irt_nexe] |
| 886 ) | 886 ) |
| 887 env.AddNodeToTestSuite(node, ['small_tests'], 'run_unaligned_data_irt_test') | 887 env.AddNodeToTestSuite(node, ['small_tests'], 'run_unaligned_data_irt_test') |
| 888 | 888 |
| 889 # ---------------------------------------------------------- | 889 # ---------------------------------------------------------- |
| 890 # Small tests with canned binaries | |
| 891 # ---------------------------------------------------------- | |
| 892 | |
| 893 if env.Bit('target_x86_64'): | |
| 894 node = env.CommandSelLdrTestNacl( | |
|
Mark Seaborn
2013/10/15 23:38:45
Why is this moved?
petarj
2013/10/16 00:24:37
It is not this part that was moved, but the other
| |
| 895 'hello_x32.out', | |
| 896 env.File(os.path.join(arch_testdata_dir, 'hello_x32.nexe')), | |
| 897 stdout_golden=env.File(os.path.join('${MAIN_DIR}', | |
| 898 'tests/hello_world', | |
| 899 'hello_world.stdout')) | |
| 900 ) | |
| 901 env.AddNodeToTestSuite(node, ['small_tests'], 'run_hello_x32_test') | |
| 902 | |
| 903 # ---------------------------------------------------------- | |
| 890 # Integration Tests With Canned x86 Binaries | 904 # Integration Tests With Canned x86 Binaries |
| 891 # ---------------------------------------------------------- | 905 # ---------------------------------------------------------- |
| 892 # To update the canned tests run: | 906 # To update the canned tests run: |
| 893 # ./scons platform=x86-64 | 907 # ./scons platform=x86-64 |
| 894 # cp scons-out/nacl-x86-64/staging/{mandel.nexe,fib_*} \ | 908 # cp scons-out/nacl-x86-64/staging/{mandel.nexe,fib_*} \ |
| 895 # src/trusted/service_runtime/testdata/x86_64/ | 909 # src/trusted/service_runtime/testdata/x86_64/ |
| 896 # ./scons platform=x86-32 | 910 # ./scons platform=x86-32 |
| 897 # cp scons-out/nacl-x86-32/staging/{mandel.nexe,fib_*} \ | 911 # cp scons-out/nacl-x86-32/staging/{mandel.nexe,fib_*} \ |
| 898 # src/trusted/service_runtime/testdata/x86_32/ | 912 # src/trusted/service_runtime/testdata/x86_32/ |
| 899 | 913 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 912 node = env.SelUniversalTest( | 926 node = env.SelUniversalTest( |
| 913 test + '_canned.out', | 927 test + '_canned.out', |
| 914 env.File(arch_testdata_dir + '/' + test + '.nexe'), | 928 env.File(arch_testdata_dir + '/' + test + '.nexe'), |
| 915 stdin = location + '.stdin', | 929 stdin = location + '.stdin', |
| 916 stdout_golden = location + '.stdout', | 930 stdout_golden = location + '.stdout', |
| 917 ) | 931 ) |
| 918 env.AddNodeToTestSuite(node, | 932 env.AddNodeToTestSuite(node, |
| 919 ['medium_tests'], | 933 ['medium_tests'], |
| 920 'run_%s_integration_test' % test) | 934 'run_%s_integration_test' % test) |
| 921 | 935 |
| 922 if env.Bit('target_x86'): | 936 if env.Bit('target_x86') and not env.Bit('bitcode'): |
| 923 RE_HELLO = '^(Hello, World!)$' | 937 RE_HELLO = '^(Hello, World!)$' |
| 924 RE_IDENT = '^\[[0-9,:.]*\] (e_ident\+1 = ELF)$' | 938 RE_IDENT = '^\[[0-9,:.]*\] (e_ident\+1 = ELF)$' |
| 925 | 939 |
| 926 node = env.CommandSelLdrTestNacl( | 940 node = untrusted_env.CommandSelLdrTestNacl( |
| 927 'nacl_log.out', | 941 'nacl_log.out', |
| 928 env.File(arch_testdata_dir + '/hello_world.nexe'), | 942 hello_world_nexe, |
| 929 log_golden = env.File('testdata/hello_world.log'), | 943 log_golden = env.File('testdata/hello_world.log'), |
| 930 stdout_golden = env.File('testdata/hello_world.stdout'), | 944 stdout_golden = env.File('testdata/hello_world.stdout'), |
| 931 filter_regex = '"' + RE_HELLO + '|' + RE_IDENT + '"', | 945 filter_regex = '"' + RE_HELLO + '|' + RE_IDENT + '"', |
| 932 filter_group_only = 'true', | 946 filter_group_only = 'true', |
| 933 ) | 947 ) |
| 934 env.AddNodeToTestSuite(node, ['medium_tests'], | 948 env.AddNodeToTestSuite(node, ['medium_tests'], |
| 935 'run_service_runtime_hello_world_test') | 949 'run_service_runtime_hello_world_test') |
| 936 | 950 |
| 937 assert len(INTEGRATION_TESTS_X86) == len(INTEGRATION_TESTS_X86_STDIN_OUT) | 951 assert len(INTEGRATION_TESTS_X86) == len(INTEGRATION_TESTS_X86_STDIN_OUT) |
| 938 map(AddIntegrationTest, | 952 map(AddIntegrationTest, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1068 is_broken=is_broken) | 1082 is_broken=is_broken) |
| 1069 | 1083 |
| 1070 dyn_array_test_exe = env.ComponentProgram('dyn_array_test', | 1084 dyn_array_test_exe = env.ComponentProgram('dyn_array_test', |
| 1071 ['dyn_array_test.c'], | 1085 ['dyn_array_test.c'], |
| 1072 EXTRA_LIBS=sel_ldr_libs) | 1086 EXTRA_LIBS=sel_ldr_libs) |
| 1073 | 1087 |
| 1074 node = env.CommandTest('dyn_array_test.out', | 1088 node = env.CommandTest('dyn_array_test.out', |
| 1075 command=[dyn_array_test_exe]) | 1089 command=[dyn_array_test_exe]) |
| 1076 | 1090 |
| 1077 env.AddNodeToTestSuite(node, ['small_tests'], 'run_dyn_array_test') | 1091 env.AddNodeToTestSuite(node, ['small_tests'], 'run_dyn_array_test') |
| OLD | NEW |