pchdelta.py (9f22d7c2) pchdelta.py (86f29464)
1#!/usr/bin/python
1#!/usr/bin/env python
2# *************************************************************
3#
4# Licensed to the Apache Software Foundation (ASF) under one
5# or more contributor license agreements. See the NOTICE file
6# distributed with this work for additional information
7# regarding copyright ownership. The ASF licenses this file
8# to you under the Apache License, Version 2.0 (the
9# "License"); you may not use this file except in compliance

--- 10 unchanged lines hidden (view full) ---

20#
21# *************************************************************
22
23
24# ------------------------------------------------------------------------------
25# Hacky little delta debug tool to figure out the proper includes for a pch file
26#
27# Usage:
2# *************************************************************
3#
4# Licensed to the Apache Software Foundation (ASF) under one
5# or more contributor license agreements. See the NOTICE file
6# distributed with this work for additional information
7# regarding copyright ownership. The ASF licenses this file
8# to you under the Apache License, Version 2.0 (the
9# "License"); you may not use this file except in compliance

--- 10 unchanged lines hidden (view full) ---

20#
21# *************************************************************
22
23
24# ------------------------------------------------------------------------------
25# Hacky little delta debug tool to figure out the proper includes for a pch file
26#
27# Usage:
28#
28#
29# pchdelta.py <pch_target> <dir1> [<dir2> <dir3> ...]
30#
31# <pch_target> File to perform delta debugging on. The section to test
32# is delimeted by '//---MARKER---' lines.
33# <dir1> .. <dirn> Sequence of directories to run dmake in to test if the
34# modification works
35#
36# Examples:

--- 40 unchanged lines hidden (view full) ---

77 outputfile.write("\n".join(acceptedlines))
78 if len(testlines) > 0:
79 outputfile.write("\n\n//---Candidate marker---\n")
80 outputfile.write("\n".join(testlines) + "\n")
81 outputfile.write("//---Candidate marker end---\n")
82 outputfile.write(MARKER)
83 outputfile.write(footer)
84 outputfile.close()
29# pchdelta.py <pch_target> <dir1> [<dir2> <dir3> ...]
30#
31# <pch_target> File to perform delta debugging on. The section to test
32# is delimeted by '//---MARKER---' lines.
33# <dir1> .. <dirn> Sequence of directories to run dmake in to test if the
34# modification works
35#
36# Examples:

--- 40 unchanged lines hidden (view full) ---

77 outputfile.write("\n".join(acceptedlines))
78 if len(testlines) > 0:
79 outputfile.write("\n\n//---Candidate marker---\n")
80 outputfile.write("\n".join(testlines) + "\n")
81 outputfile.write("//---Candidate marker end---\n")
82 outputfile.write(MARKER)
83 outputfile.write(footer)
84 outputfile.close()
85
86
85
86
87# ------------------------------------------------------------------------------
88# Recursive tester routine. Test the segment given and if an error is
89# encountered splits the segment into <fanout> subsegment and recurses. Failing
90# one liners are rejected. The set of accepted lines are built sequentially from
91# the beginning.
92
93def binaryTest(dirlist, lines, pchname, header, footer, acceptedlines, indent, startpoint):
94 linecount = len(lines)

--- 65 unchanged lines hidden (view full) ---

160 writePch(pchname, header, footer, lines, [])
161 print "Building with no candidate lines failed. Convergence questionable, aborting."
162 sys.exit(0)
163
164# Starting pruning
165print "Starting evaluation of " + str(len(lines)) + " lines"
166acceptedlines = binaryTest(dirlist, lines, pchname, header, footer, [], "", 0)
167writePch(pchname, header, footer, acceptedlines, [])
87# ------------------------------------------------------------------------------
88# Recursive tester routine. Test the segment given and if an error is
89# encountered splits the segment into <fanout> subsegment and recurses. Failing
90# one liners are rejected. The set of accepted lines are built sequentially from
91# the beginning.
92
93def binaryTest(dirlist, lines, pchname, header, footer, acceptedlines, indent, startpoint):
94 linecount = len(lines)

--- 65 unchanged lines hidden (view full) ---

160 writePch(pchname, header, footer, lines, [])
161 print "Building with no candidate lines failed. Convergence questionable, aborting."
162 sys.exit(0)
163
164# Starting pruning
165print "Starting evaluation of " + str(len(lines)) + " lines"
166acceptedlines = binaryTest(dirlist, lines, pchname, header, footer, [], "", 0)
167writePch(pchname, header, footer, acceptedlines, [])
168
169
170