| 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 # Tests for Native Client fixed-feature CPU mode. The fixed-feature CPU | 6 # Tests for Native Client fixed-feature CPU mode. The fixed-feature CPU |
| 7 # mode requires SSE and disallows MMX and x87. By fixing the instruction set | 7 # mode requires SSE and disallows MMX and x87. By fixing the instruction set |
| 8 # it allows exclusion of the CPUID instruction and use of a read-only text | 8 # it allows exclusion of the CPUID instruction and use of a read-only text |
| 9 # segment. See http://code.google.com/p/nativeclient/issues/detail?id=2684 | 9 # segment. See http://code.google.com/p/nativeclient/issues/detail?id=2684 |
| 10 Import('env') | 10 Import('env') |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 # TODO(bradchen): Consolidate into env.ValidationIsDisabled() | 30 # TODO(bradchen): Consolidate into env.ValidationIsDisabled() |
| 31 is_validation_broken = env.IsRunningUnderValgrind() | 31 is_validation_broken = env.IsRunningUnderValgrind() |
| 32 | 32 |
| 33 # The next sequence of conditionals captures the status test on various | 33 # The next sequence of conditionals captures the status test on various |
| 34 # NaCl configurations. At this point many of the '-Z' configurations fail | 34 # NaCl configurations. At this point many of the '-Z' configurations fail |
| 35 # due to MMX or x87 instructions that are included in shared runtime | 35 # due to MMX or x87 instructions that are included in shared runtime |
| 36 # components. The production fixed-function toolchain must remove these | 36 # components. The production fixed-function toolchain must remove these |
| 37 # problems. | 37 # problems. |
| 38 if env.Bit('tests_use_irt'): | 38 if env.Bit('tests_use_irt'): |
| 39 if (env.Bit('target_x86_64') and | 39 if (env.Bit('target_x86_64') and |
| 40 env.Bit('validator_ragel') and | |
| 41 not env.Bit('nacl_glibc')): | 40 not env.Bit('nacl_glibc')): |
| 42 # R-DFA ignores LM bit and assumes it's always enabled | 41 # R-DFA ignores LM bit and assumes it's always enabled |
| 43 expect_null_Z_status=0 | 42 expect_null_Z_status=0 |
| 44 expect_sse_Z_status=0 | 43 expect_sse_Z_status=0 |
| 45 else: | 44 else: |
| 46 # 32-bit irt newlib: requeres MMX(prefetchnta),CLFLUSH/FXSR(sfence) | 45 # 32-bit irt newlib: requeres MMX(prefetchnta),CLFLUSH/FXSR(sfence) |
| 47 # 64-bit irt newlib: requires LM(cltq),MMX(prefetchnta),CLFLUSH/FXSR(sfence) | 46 # 64-bit irt newlib: requires LM(cltq),MMX(prefetchnta),CLFLUSH/FXSR(sfence) |
| 48 # prefetchnta and sfence are classified incorrectly in the old validator | |
| 49 expect_null_Z_status=1 | 47 expect_null_Z_status=1 |
| 50 expect_sse_Z_status=1 | 48 expect_sse_Z_status=1 |
| 51 expect_x87_Z_status=1 | 49 expect_x87_Z_status=1 |
| 52 elif env.Bit('nacl_glibc'): | 50 elif env.Bit('nacl_glibc'): |
| 53 if env.Bit('target_x86_32'): | 51 if env.Bit('target_x86_32'): |
| 54 # Validation fails with code 127 when dynamic linking | 52 # Validation fails with code 127 when dynamic linking |
| 55 expect_null_Z_status=127 | 53 expect_null_Z_status=127 |
| 56 expect_sse_Z_status=127 | 54 expect_sse_Z_status=127 |
| 57 expect_x87_Z_status=127 | 55 expect_x87_Z_status=127 |
| 58 elif env.Bit('target_x86_64'): | 56 elif env.Bit('target_x86_64'): |
| 59 # 64-bit glibc: fails, runnable-ld.so requires RDTSC, x87 | 57 # 64-bit glibc: fails, runnable-ld.so requires RDTSC, x87 |
| 60 expect_null_Z_status=1 | 58 expect_null_Z_status=1 |
| 61 expect_sse_Z_status=1 | 59 expect_sse_Z_status=1 |
| 62 expect_x87_Z_status=1 | 60 expect_x87_Z_status=1 |
| 63 else: | 61 else: |
| 64 if env.Bit('target_x86_32'): | 62 if env.Bit('target_x86_32'): |
| 65 # 32-bit newlib: passes | 63 # 32-bit newlib: passes |
| 66 expect_null_Z_status=0 | 64 expect_null_Z_status=0 |
| 67 expect_sse_Z_status=1 | 65 expect_sse_Z_status=1 |
| 68 expect_x87_Z_status=1 | 66 expect_x87_Z_status=1 |
| 69 elif env.Bit('target_x86_64'): | 67 elif env.Bit('target_x86_64'): |
| 70 if env.Bit('validator_ragel'): | 68 # R-DFA ignores LM bit and assumes it's always enabled |
| 71 # R-DFA ignores LM bit and assumes it's always enabled | 69 expect_null_Z_status=0 |
| 72 expect_null_Z_status=0 | 70 expect_sse_Z_status=0 |
| 73 expect_sse_Z_status=0 | |
| 74 else: | |
| 75 # 64-bit newlib: requires LM(cltq), MMX(prefetchnta), CLFLUSH/FXSR(sfence) | |
| 76 # prefetchnta and sfence are classified incorrectly in the old validator | |
| 77 expect_null_Z_status=1 | |
| 78 expect_sse_Z_status=1 | |
| 79 expect_x87_Z_status=1 | 71 expect_x87_Z_status=1 |
| 80 | 72 |
| 81 test_suites = ['small_tests', 'sel_ldr_tests', 'validator_tests'] | 73 test_suites = ['small_tests', 'sel_ldr_tests', 'validator_tests'] |
| 82 ff_null_nexe = env.ComponentProgram('ff_null', 'ff_null.c', | 74 ff_null_nexe = env.ComponentProgram('ff_null', 'ff_null.c', |
| 83 EXTRA_LIBS=['${NONIRT_LIBS}']) | 75 EXTRA_LIBS=['${NONIRT_LIBS}']) |
| 84 node = env.CommandSelLdrTestNacl('ff_null.out', ff_null_nexe) | 76 node = env.CommandSelLdrTestNacl('ff_null.out', ff_null_nexe) |
| 85 env.AddNodeToTestSuite(node, test_suites, 'run_ff_null_test') | 77 env.AddNodeToTestSuite(node, test_suites, 'run_ff_null_test') |
| 86 | 78 |
| 87 node = env.CommandSelLdrTestNacl( | 79 node = env.CommandSelLdrTestNacl( |
| 88 'ff_null_Z.out', ff_null_nexe, | 80 'ff_null_Z.out', ff_null_nexe, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 stdout_golden=env.File('ff_hello_world.stdout')) | 125 stdout_golden=env.File('ff_hello_world.stdout')) |
| 134 env.AddNodeToTestSuite(node, test_suites, 'run_ff_x87_test') | 126 env.AddNodeToTestSuite(node, test_suites, 'run_ff_x87_test') |
| 135 | 127 |
| 136 # ff_hello_world_x87 should fail in fixed function CPU mode | 128 # ff_hello_world_x87 should fail in fixed function CPU mode |
| 137 node = env.CommandSelLdrTestNacl( | 129 node = env.CommandSelLdrTestNacl( |
| 138 'ff_hello_world_x87_Z.out', ff_hello_world_x87_nexe, | 130 'ff_hello_world_x87_Z.out', ff_hello_world_x87_nexe, |
| 139 exit_status=expect_x87_Z_status, | 131 exit_status=expect_x87_Z_status, |
| 140 sel_ldr_flags=['-Z']) | 132 sel_ldr_flags=['-Z']) |
| 141 env.AddNodeToTestSuite(node, test_suites, 'run_ff_x87_Z_test', | 133 env.AddNodeToTestSuite(node, test_suites, 'run_ff_x87_Z_test', |
| 142 is_broken=is_validation_broken) | 134 is_broken=is_validation_broken) |
| OLD | NEW |