2 """Compare the results of native and cross-compiled configure tests
4 The compared files are called "default.cache.py" and are generated in
7 USAGE: compare_cc_results.py CONFIG_1 CONFIG_2 [CONFIG_3 [CONFIG_4 ...]]
9 from __future__
import print_function
14 'BUILD_DIRECTORY', 'SELFTEST_PREFIX', 'defines',
15 'CROSS_COMPILE', 'CROSS_ANSWERS', 'CROSS_EXECUTE',
16 'LIBSOCKET_WRAPPER_SO_PATH',
17 'LIBNSS_WRAPPER_SO_PATH',
18 'LIBPAM_WRAPPER_SO_PATH',
19 'PAM_SET_ITEMS_SO_PATH',
20 'LIBUID_WRAPPER_SO_PATH',
21 'LIBRESOLV_WRAPPER_SO_PATH',
33 for fname
in sys
.argv
[1:]:
37 if line
.startswith("cfg_files ="):
38 # waf writes configuration files as absolute paths
40 if len(line
.split('=', 1)) == 2:
41 key
= line
.split('=', 1)[0].strip()
42 value
= line
.split('=', 1)[1].strip()
45 # using waf with python 3.4 seems to randomly sort dict keys
46 # we can't modify the waf code but we can fake a dict value
47 # string representation as if it were sorted. python 3.6.5
48 # doesn't seem to suffer from this behaviour
49 if value
.startswith('{'):
51 amap
= ast
.literal_eval(value
)
53 for k
in sorted(amap
.keys()):
54 if not len(fakeline
) == 0:
55 fakeline
= fakeline
+ ", "
56 fakeline
= fakeline
+ '\'' + k
+ '\': \'' + amap
[k
] + '\''
57 line
= key
+ ' = {' + fakeline
+ '}'
61 diff
= list(difflib
.unified_diff(base_lines
, lines
, base_fname
, fname
))
63 print('configuration files %s and %s do not match' % (base_fname
, fname
))