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 untrusted_env = env.MakeUntrustedNativeEnv() | |
558 hello_world_nexe = untrusted_env.File('$STAGING_DIR/hello_world.nexe') | |
Mark Seaborn
2013/10/17 00:06:40
Can you use $PROGSUFFIX instead of .nexe to match
petarj
2013/10/17 18:52:49
Using $PROGSUFFIX causes a conflict for bitcode=1
| |
557 | 559 |
558 # Doesn't work on windows under coverage. | 560 # Doesn't work on windows under coverage. |
559 # TODO(bradnelson): fix this to work on windows under coverage. | 561 # TODO(bradnelson): fix this to work on windows under coverage. |
560 if not env.Bit('windows') or not env.Bit('coverage_enabled'): | 562 if ((not env.Bit('windows') or not env.Bit('coverage_enabled')) and |
563 not env.Bit('nacl_glibc')): | |
Mark Seaborn
2013/10/17 00:06:40
Make this "env.Bit('nacl_static_link')" (no "not")
petarj
2013/10/17 18:52:49
Done.
| |
561 # NOTE: uses validator | 564 # NOTE: uses validator |
562 mmap_test_objs = [env.ComponentObject('mmap_test.c')] | 565 mmap_test_objs = [env.ComponentObject('mmap_test.c')] |
563 mmap_test_exe = env.ComponentProgram( | 566 mmap_test_exe = env.ComponentProgram( |
564 'mmap_test', | 567 'mmap_test', |
565 mmap_test_objs, | 568 mmap_test_objs, |
566 EXTRA_LIBS=['sel', | 569 EXTRA_LIBS=['sel', |
567 'env_cleanser', | 570 'env_cleanser', |
568 'manifest_proxy', | 571 'manifest_proxy', |
569 'simple_service', | 572 'simple_service', |
570 'thread_interface', | 573 'thread_interface', |
571 'gio_wrapped_desc', | 574 'gio_wrapped_desc', |
572 'nonnacl_srpc', | 575 'nonnacl_srpc', |
573 'nrd_xfer', | 576 'nrd_xfer', |
574 'nacl_perf_counter', | 577 'nacl_perf_counter', |
575 'nacl_base', | 578 'nacl_base', |
576 'imc', | 579 'imc', |
577 'nacl_fault_inject', | 580 'nacl_fault_inject', |
578 'nacl_interval', | 581 'nacl_interval', |
579 'platform', | 582 'platform', |
580 'sel_test', | 583 'sel_test', |
581 ]) | 584 ]) |
582 | 585 |
583 mmap_test_file = env.File(arch_testdata_dir + '/hello_world.nexe') | 586 mmap_test_command = env.AddBootstrap(mmap_test_exe, [hello_world_nexe]) |
584 mmap_test_command = env.AddBootstrap(mmap_test_exe, [mmap_test_file]) | |
585 | 587 |
586 # TODO(robertm): This test emits lots of messages to stderr | 588 # TODO(robertm): This test emits lots of messages to stderr |
587 node = env.CommandTest ( | 589 node = env.CommandTest ( |
588 "mmap_test.out", | 590 "mmap_test.out", |
589 command=mmap_test_command, | 591 command=mmap_test_command, |
590 # TODO(mseaborn): Extend this test to cover the case where the | 592 # TODO(mseaborn): Extend this test to cover the case where the |
591 # dynamic code segment is present. | 593 # dynamic code segment is present. |
592 osenv='NACL_DISABLE_DYNAMIC_LOADING=1') | 594 osenv='NACL_DISABLE_DYNAMIC_LOADING=1') |
593 env.AddNodeToTestSuite(node, ['medium_tests'], 'run_trusted_mmap_test') | 595 env.AddNodeToTestSuite(node, ['medium_tests'], 'run_trusted_mmap_test') |
594 | 596 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
793 | 795 |
794 # Test that sel_ldr does not crash if the executable file cannot be opened. | 796 # Test that sel_ldr does not crash if the executable file cannot be opened. |
795 node = env.CommandSelLdrTestNacl( | 797 node = env.CommandSelLdrTestNacl( |
796 'sel_ldr_exe_not_found.out', | 798 'sel_ldr_exe_not_found.out', |
797 'name_of_file_that_does_not_exist.nexe', | 799 'name_of_file_that_does_not_exist.nexe', |
798 exit_status='1') | 800 exit_status='1') |
799 env.AddNodeToTestSuite(node, ['small_tests'], 'run_sel_ldr_exe_not_found_test') | 801 env.AddNodeToTestSuite(node, ['small_tests'], 'run_sel_ldr_exe_not_found_test') |
800 | 802 |
801 # Check that "-F" makes sel_ldr stop after loading the nexe but before running | 803 # Check that "-F" makes sel_ldr stop after loading the nexe but before running |
802 # it. | 804 # it. |
803 if not env.Bit('bitcode') or env.Bit('target_mips32'): | 805 nullptr_nexe = untrusted_env.GetTranslatedNexe( |
804 untrusted_env = env.MakeUntrustedNativeEnv() | 806 untrusted_env.File('$STAGING_DIR/nullptr$PROGSUFFIX')) |
805 nullptr_src = env.File('${MAIN_DIR}/tests/nullptr/nullptr.c') | |
806 nullptr_obj = untrusted_env.ComponentObject('nullptr', nullptr_src) | |
807 nullptr_nexe = untrusted_env.ComponentProgram('nullptr', nullptr_obj) | |
808 | 807 |
809 node = env.CommandSelLdrTestNacl( | 808 node = env.CommandSelLdrTestNacl( |
810 'fuzz_nullptr_test.out', | 809 'fuzz_nullptr_test.out', |
811 nullptr_nexe, | 810 nullptr_nexe, |
812 sel_ldr_flags=['-F']) | 811 sel_ldr_flags=['-F']) |
813 env.AddNodeToTestSuite(node, ['small_tests'], 'run_fuzz_nullptr_test') | 812 env.AddNodeToTestSuite(node, ['small_tests'], 'run_fuzz_nullptr_test') |
814 | 813 |
815 # ---------------------------------------------------------- | 814 # Test hello_world binary with obsolete, non-ragel based validator. |
816 # Small tests with canned binaries | 815 if (not env.Bit('validator_ragel') and env.Bit('target_x86') |
817 # ---------------------------------------------------------- | 816 and not env.Bit('nacl_glibc')): |
Mark Seaborn
2013/10/17 00:06:40
Not sure why this wouldn't work with dynamic linki
petarj
2013/10/17 18:52:49
untrusted_env has an issue with bitcode=1 while ca
| |
818 | |
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( | 817 node = env.CommandSelLdrTestNacl( |
832 'dfa_hwd.out', | 818 'dfa_hwd.out', |
833 env.File(arch_testdata_dir + '/hello_world.nexe'), | 819 hello_world_nexe, |
834 stdout_golden = env.File('testdata/hello_world.stdout'), | 820 stdout_golden = env.File('testdata/hello_world.stdout'), |
835 stderr_golden = env.File('testdata/non_dfa_validator_hello.stderr'), | 821 stderr_golden = env.File('testdata/non_dfa_validator_hello.stderr'), |
836 filter_regex = '"^(Hello, World!)$' + '|' + | 822 filter_regex = '"^(Hello, World!)$' + '|' + |
837 '^[[][^]]*[]] (USING OBSOLETE NON-DFA-BASED VALIDATOR!)$"', | 823 '^[[][^]]*[]] (USING OBSOLETE NON-DFA-BASED VALIDATOR!)$"', |
838 filter_group_only = 'true', | 824 filter_group_only = 'true', |
839 ) | 825 ) |
840 env.AddNodeToTestSuite(node, ['medium_tests', 'validator_tests'], | 826 env.AddNodeToTestSuite(node, ['medium_tests', 'validator_tests'], |
841 'run_dfa_validator_hello_world_test') | 827 'run_dfa_validator_hello_world_test') |
842 | 828 |
843 if env.Bit('target_mips32'): | 829 if env.Bit('target_mips32'): |
844 text_region_start = 0x00020000 | 830 text_region_start = 0x00020000 |
845 # Use arbitrary non-page-aligned addresses for data and rodata. | 831 # Use arbitrary non-page-aligned addresses for data and rodata. |
846 rodata_region_start = 0x10020094 | 832 rodata_region_start = 0x10020094 |
847 data_region_start = 0x10030098 | 833 data_region_start = 0x10030098 |
848 untrusted_env = env.MakeUntrustedNativeEnv() | |
849 untrusted_env.Append(CPPFLAGS=['--pnacl-allow-native', '-arch', 'mips32']) | 834 untrusted_env.Append(CPPFLAGS=['--pnacl-allow-native', '-arch', 'mips32']) |
850 unaligned_data_objs = untrusted_env.ComponentObject( | 835 unaligned_data_objs = untrusted_env.ComponentObject( |
851 'arch/mips/unaligned_data_test.S') | 836 'arch/mips/unaligned_data_test.S') |
852 unaligned_data_nexe = untrusted_env.ComponentProgram( | 837 unaligned_data_nexe = untrusted_env.ComponentProgram( |
853 'unaligned_data.nexe', | 838 'unaligned_data.nexe', |
854 unaligned_data_objs, | 839 unaligned_data_objs, |
855 LINKFLAGS=['-nostdlib', | 840 LINKFLAGS=['-nostdlib', |
856 '--pnacl-allow-native', '-arch', 'mips32', | 841 '--pnacl-allow-native', '-arch', 'mips32', |
857 '-Wn,--section-start=.text=0x%x' % (text_region_start), | 842 '-Wn,--section-start=.text=0x%x' % (text_region_start), |
858 '-Wn,--section-start=.rodata=0x%x' % (rodata_region_start), | 843 '-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') | 865 env.AddNodeToTestSuite(node, ['small_tests'], 'run_unaligned_data_test') |
881 | 866 |
882 node = env.CommandSelLdrTestNacl( | 867 node = env.CommandSelLdrTestNacl( |
883 'unaligned_data_irt.out', | 868 'unaligned_data_irt.out', |
884 unaligned_data_nexe, | 869 unaligned_data_nexe, |
885 sel_ldr_flags=['-B', unaligned_data_irt_nexe] | 870 sel_ldr_flags=['-B', unaligned_data_irt_nexe] |
886 ) | 871 ) |
887 env.AddNodeToTestSuite(node, ['small_tests'], 'run_unaligned_data_irt_test') | 872 env.AddNodeToTestSuite(node, ['small_tests'], 'run_unaligned_data_irt_test') |
888 | 873 |
889 # ---------------------------------------------------------- | 874 # ---------------------------------------------------------- |
875 # Small tests with canned binaries | |
876 # ---------------------------------------------------------- | |
877 | |
878 if env.Bit('target_x86_64'): | |
879 node = env.CommandSelLdrTestNacl( | |
880 'hello_x32.out', | |
881 env.File(os.path.join(arch_testdata_dir, 'hello_x32.nexe')), | |
882 stdout_golden=env.File(os.path.join('${MAIN_DIR}', | |
883 'tests/hello_world', | |
884 'hello_world.stdout')) | |
885 ) | |
886 env.AddNodeToTestSuite(node, ['small_tests'], 'run_hello_x32_test') | |
887 | |
888 # ---------------------------------------------------------- | |
890 # Integration Tests With Canned x86 Binaries | 889 # Integration Tests With Canned x86 Binaries |
891 # ---------------------------------------------------------- | 890 # ---------------------------------------------------------- |
892 # To update the canned tests run: | 891 # To update the canned tests run: |
893 # ./scons platform=x86-64 | 892 # ./scons platform=x86-64 |
894 # cp scons-out/nacl-x86-64/staging/{mandel.nexe,fib_*} \ | 893 # cp scons-out/nacl-x86-64/staging/{mandel.nexe,fib_*} \ |
895 # src/trusted/service_runtime/testdata/x86_64/ | 894 # src/trusted/service_runtime/testdata/x86_64/ |
896 # ./scons platform=x86-32 | 895 # ./scons platform=x86-32 |
897 # cp scons-out/nacl-x86-32/staging/{mandel.nexe,fib_*} \ | 896 # cp scons-out/nacl-x86-32/staging/{mandel.nexe,fib_*} \ |
898 # src/trusted/service_runtime/testdata/x86_32/ | 897 # src/trusted/service_runtime/testdata/x86_32/ |
899 | 898 |
(...skipping 12 matching lines...) Expand all Loading... | |
912 node = env.SelUniversalTest( | 911 node = env.SelUniversalTest( |
913 test + '_canned.out', | 912 test + '_canned.out', |
914 env.File(arch_testdata_dir + '/' + test + '.nexe'), | 913 env.File(arch_testdata_dir + '/' + test + '.nexe'), |
915 stdin = location + '.stdin', | 914 stdin = location + '.stdin', |
916 stdout_golden = location + '.stdout', | 915 stdout_golden = location + '.stdout', |
917 ) | 916 ) |
918 env.AddNodeToTestSuite(node, | 917 env.AddNodeToTestSuite(node, |
919 ['medium_tests'], | 918 ['medium_tests'], |
920 'run_%s_integration_test' % test) | 919 'run_%s_integration_test' % test) |
921 | 920 |
922 if env.Bit('target_x86'): | 921 if env.Bit('target_x86') and not env.Bit('nacl_glibc'): |
Mark Seaborn
2013/10/17 00:06:40
Same here.
| |
923 RE_HELLO = '^(Hello, World!)$' | 922 RE_HELLO = '^(Hello, World!)$' |
924 RE_IDENT = '^\[[0-9,:.]*\] (e_ident\+1 = ELF)$' | 923 RE_IDENT = '^\[[0-9,:.]*\] (e_ident\+1 = ELF)$' |
925 | 924 |
926 node = env.CommandSelLdrTestNacl( | 925 node = env.CommandSelLdrTestNacl( |
927 'nacl_log.out', | 926 'nacl_log.out', |
928 env.File(arch_testdata_dir + '/hello_world.nexe'), | 927 hello_world_nexe, |
929 log_golden = env.File('testdata/hello_world.log'), | 928 log_golden = env.File('testdata/hello_world.log'), |
930 stdout_golden = env.File('testdata/hello_world.stdout'), | 929 stdout_golden = env.File('testdata/hello_world.stdout'), |
931 filter_regex = '"' + RE_HELLO + '|' + RE_IDENT + '"', | 930 filter_regex = '"' + RE_HELLO + '|' + RE_IDENT + '"', |
932 filter_group_only = 'true', | 931 filter_group_only = 'true', |
933 ) | 932 ) |
934 env.AddNodeToTestSuite(node, ['medium_tests'], | 933 env.AddNodeToTestSuite(node, ['medium_tests'], |
935 'run_service_runtime_hello_world_test') | 934 'run_service_runtime_hello_world_test') |
936 | 935 |
937 assert len(INTEGRATION_TESTS_X86) == len(INTEGRATION_TESTS_X86_STDIN_OUT) | 936 assert len(INTEGRATION_TESTS_X86) == len(INTEGRATION_TESTS_X86_STDIN_OUT) |
938 map(AddIntegrationTest, | 937 map(AddIntegrationTest, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1068 is_broken=is_broken) | 1067 is_broken=is_broken) |
1069 | 1068 |
1070 dyn_array_test_exe = env.ComponentProgram('dyn_array_test', | 1069 dyn_array_test_exe = env.ComponentProgram('dyn_array_test', |
1071 ['dyn_array_test.c'], | 1070 ['dyn_array_test.c'], |
1072 EXTRA_LIBS=sel_ldr_libs) | 1071 EXTRA_LIBS=sel_ldr_libs) |
1073 | 1072 |
1074 node = env.CommandTest('dyn_array_test.out', | 1073 node = env.CommandTest('dyn_array_test.out', |
1075 command=[dyn_array_test_exe]) | 1074 command=[dyn_array_test_exe]) |
1076 | 1075 |
1077 env.AddNodeToTestSuite(node, ['small_tests'], 'run_dyn_array_test') | 1076 env.AddNodeToTestSuite(node, ['small_tests'], 'run_dyn_array_test') |
OLD | NEW |