Fix fstat() to filter st_mode correctly
[nativeclient.git] / tools / update_death_test_files.py
blob1e46faca194c0cef9db4eb0f584fdca5d1645f86
1 #!/usr/bin/python
4 """Update the OS ABI number of known death test NaCl modules.
6 Driver code to update death test nexe files. The user is expected to
7 run this on a Linux or OSX system (due to file paths) in the
8 native_client directory.
10 """
12 import re
13 import sys
15 import set_abi_version
18 NACL_DEATH_TESTS = [
19 'service_runtime/testdata/integer_overflow_while_madvising.nexe',
20 'service_runtime/testdata/negative_hole.nexe',
21 'service_runtime/testdata/text_too_big.nexe',
25 def GetCurrentAbiVersion():
26 return int(re.search(r'^#define.*EF_NACL_ABIVERSION\s+(\d+)',
27 open('include/nacl_elf.h', 'rt').read(),
28 re.M).group(1))
31 def main():
32 abi = GetCurrentAbiVersion()
33 for f in NACL_DEATH_TESTS:
34 print 'Updating: ', f
35 try:
36 set_abi_version.ModifyFileOsAbiVersion(f, abi)
37 except IOError, e:
38 print 'FAILED: ', str(e)
39 return 1
40 # endtry
41 # endfor
42 # enddef
44 if __name__ == '__main__':
45 sys.exit(main())
46 # endif