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 ...]]
13 'BUILD_DIRECTORY', 'SELFTEST_PREFIX', 'defines',
14 'CROSS_COMPILE', 'CROSS_ANSWERS', 'CROSS_EXECUTE',
15 'LIBSOCKET_WRAPPER_SO_PATH',
16 'LIBNSS_WRAPPER_SO_PATH',
17 'LIBPAM_WRAPPER_SO_PATH',
18 'PAM_SET_ITEMS_SO_PATH',
19 'LIBUID_WRAPPER_SO_PATH',
20 'LIBRESOLV_WRAPPER_SO_PATH',
32 for fname in sys.argv[1:]:
36 if line.startswith("cfg_files ="):
37 # waf writes configuration files as absolute paths
39 if len(line.split('=', 1)) == 2:
40 key = line.split('=', 1)[0].strip()
41 value = line.split('=', 1)[1].strip()
44 # using waf with python 3.4 seems to randomly sort dict keys
45 # we can't modify the waf code but we can fake a dict value
46 # string representation as if it were sorted. python 3.6.5
47 # doesn't seem to suffer from this behaviour
48 if value.startswith('{'):
50 amap = ast.literal_eval(value)
52 for k in sorted(amap.keys()):
53 if not len(fakeline) == 0:
54 fakeline = fakeline + ", "
55 fakeline = fakeline + '\'' + k + '\': \'' + amap[k] + '\''
56 line = key + ' = {' + fakeline + '}'
60 diff = list(difflib.unified_diff(base_lines, lines, base_fname, fname))
62 print('configuration files %s and %s do not match' % (base_fname, fname))