summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfergus.henderson <fergus.henderson@01de4be4-8c4a-0410-9132-4925637da917>2011-04-06 14:11:00 +0000
committerfergus.henderson <fergus.henderson@01de4be4-8c4a-0410-9132-4925637da917>2011-04-06 14:11:00 +0000
commitbb5aefd4eadf6c6b7cce3b4dca214a5a73dfb6da (patch)
treeac83ae19a90f9b33f94e38369a653d65539b5761
parentbf941a082ad839b5f37d94ec4930f5194fd3c4b3 (diff)
downloaddistcc-bb5aefd4eadf6c6b7cce3b4dca214a5a73dfb6da.tar.gz
Fix some issues that caused the gdb-related tests to fail:
1. Recent gcc versions want us to use -Wl,--build-id rather than --build-id. 2. We had missed one of the places where we need to be passing that flag in. 3. With recent gcc/gdb versions, "break main; run" will sometimes stop at the first statement inside of main rather than on the function declaration. So "break main; run; step" may end up inside the code to puts() rather than in the code for main(). My fix was to use "break main; run; next" instead. It is inderminate (varies based on whether you use "-O", for example) whether we end up at the call to puts() or after the call to puts(), but either way the call to puts() should be in the gdb output log. Reviewed by Craig Silverstein. git-svn-id: http://distcc.googlecode.com/svn/trunk@738 01de4be4-8c4a-0410-9132-4925637da917
-rwxr-xr-xtest/testdistcc.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/testdistcc.py b/test/testdistcc.py
index 26a65cf..86f2a6c 100755
--- a/test/testdistcc.py
+++ b/test/testdistcc.py
@@ -1246,7 +1246,8 @@ class Gdb_Case(CompileHello_Case):
value set by the compilation.
"""
os.mkdir('link')
- cmd = self.distcc() + self.compiler() + " -o link/testtmp obj/testtmp.o"
+ cmd = self.distcc() + self.compiler() + self.build_id +
+ " -o link/testtmp obj/testtmp.o"
out, err = self.runcmd(cmd)
if out != '':
self.fail("command %s produced output:\n%s" % (`cmd`, `out`))
@@ -1261,10 +1262,15 @@ class Gdb_Case(CompileHello_Case):
# Test if the compiler supports --build-id=0xNNN.
# If so, we need to use it for this test.
+ # If not, try the alternative syntax -Wl,--build-id=0xNNN instead.
self.build_id = " --build-id=0x12345678 "
error_rc, _, _ = self.runcmd_unchecked(self.compiler() +
- (self.build_id + " -o junk %s" % self.sourceFilename()))
+ (self.build_id + " -o junk -I. %s" % self.sourceFilename()))
if error_rc != 0:
+ self.build_id = " -Wl,--build-id=0x12345678 "
+ error_rc, _, _ = self.runcmd_unchecked(self.compiler() +
+ (self.build_id + " -o junk -I. %s" % self.sourceFilename()))
+ if error_rc != 0:
self.build_id = ""
CompileHello_Case.runtest (self)
@@ -1282,7 +1288,7 @@ class Gdb_Case(CompileHello_Case):
# the gdb commands directly on the commandline using gdb --ex,
# is not as portable since only newer gdb's support it.)
f = open('gdb_commands', 'w')
- f.write('break main\nrun\nstep\n')
+ f.write('break main\nrun\nnext\n')
f.close()
out, errs = self.runcmd("gdb --batch --command=gdb_commands "
"link/%s </dev/null" % testtmp_exe)
@@ -1333,9 +1339,9 @@ class Gdb_Case(CompileHello_Case):
# generated by distcc. This is just to double-check
# that we didn't modify anything other than the ".debug_info"
# section.
- self.runcmd(self.compiler() + " -o obj/testtmp.o -I. -c %s" %
+ self.runcmd(self.compiler() + self.build_id + " -o obj/testtmp.o -I. -c %s" %
self.sourceFilename())
- self.runcmd(self.compiler() + " -o link/testtmp obj/testtmp.o")
+ self.runcmd(self.compiler() + self.build_id + " -o link/testtmp obj/testtmp.o")
self.runcmd("strip link/%s && strip run/%s" % (testtmp_exe, testtmp_exe))
# On newer versions of Linux, this works only because we pass
# --build-id=0x12345678.