179 lines
5.3 KiB
Diff
179 lines
5.3 KiB
Diff
|
commit b571f9347c4a54facadb5e948e1430bd2b89158a
|
||
|
Author: Stan Cox <scox@redhat.com>
|
||
|
Date: Fri Jun 10 09:42:43 2011 -0400
|
||
|
|
||
|
Don't process the dtrace -o FILENAME.
|
||
|
|
||
|
dtrace.in (main): Use suffix for both -h and -G. Check gcc return code.
|
||
|
dtrace.exp: Massage results accordingly.
|
||
|
|
||
|
commit f6b267eb5f999ce380f1169ba4aa81945b8b8fd2
|
||
|
Author: Stan Cox <scox@redhat.com>
|
||
|
Date: Tue Jun 14 16:16:59 2011 -0400
|
||
|
|
||
|
Improve dtrace handling of CC environment variable.
|
||
|
|
||
|
* dtrace.in (main): Split CC to allow for application Makefile abuse.
|
||
|
|
||
|
commit 4c353c3a6d5a7b75c3e897f1605ae6a98b0b1951
|
||
|
Author: Stan Cox <scox@redhat.com>
|
||
|
Date: Tue Jun 14 17:36:23 2011 -0400
|
||
|
|
||
|
Split command line pieces with shlex
|
||
|
|
||
|
dtrace.in (main): Use shlex.split for CPP, CC, and CFLAGS
|
||
|
|
||
|
commit 12aad6f0ee85529fa29d6b0790f7afc6f075a808
|
||
|
Author: Stan Cox <scox@redhat.com>
|
||
|
Date: Wed Jun 15 15:52:38 2011 -0400
|
||
|
|
||
|
Do status setting and exit at the top level.
|
||
|
|
||
|
* dtrace.in (main): Use return instead of sys.exit; move sys.exit to top.
|
||
|
|
||
|
diff --git a/dtrace.in b/dtrace.in
|
||
|
index a64d110..c1ea1fe 100755
|
||
|
--- a/dtrace.in
|
||
|
+++ b/dtrace.in
|
||
|
@@ -17,6 +17,7 @@ import os
|
||
|
import posix
|
||
|
import string
|
||
|
import sys
|
||
|
+import shlex
|
||
|
from subprocess import call
|
||
|
from tempfile import mkstemp
|
||
|
|
||
|
@@ -179,7 +180,7 @@ def help ():
|
||
|
def main():
|
||
|
if (len(sys.argv) < 2):
|
||
|
usage()
|
||
|
- sys.exit(1)
|
||
|
+ return 1
|
||
|
|
||
|
i = 1
|
||
|
build_header = False
|
||
|
@@ -187,7 +188,7 @@ def main():
|
||
|
add_typedefs = False
|
||
|
keep_temps = False
|
||
|
use_cpp = False
|
||
|
- h_ext = '.h'
|
||
|
+ suffix = ""
|
||
|
filename = ""
|
||
|
s_filename = ""
|
||
|
includes = []
|
||
|
@@ -205,10 +206,12 @@ def main():
|
||
|
defines.append(sys.argv[i])
|
||
|
elif (sys.argv[i] == "-h"):
|
||
|
build_header = True
|
||
|
+ suffix = ".h"
|
||
|
elif (sys.argv[i].startswith("-I")):
|
||
|
includes.append(sys.argv[i])
|
||
|
elif (sys.argv[i] == "-G"):
|
||
|
build_source = True
|
||
|
+ suffix = ".o"
|
||
|
elif (sys.argv[i] == "-k"):
|
||
|
keep_temps = True
|
||
|
elif (sys.argv[i] == "--types"):
|
||
|
@@ -218,17 +221,16 @@ def main():
|
||
|
i += 1
|
||
|
if (build_header == False and build_source == False):
|
||
|
usage()
|
||
|
- sys.exit(1)
|
||
|
+ return 1
|
||
|
|
||
|
if (s_filename != "" and use_cpp):
|
||
|
(d,fn) = mkstemp(suffix=".d")
|
||
|
CPP = os.environ.get("CPP", "cpp")
|
||
|
- args = [CPP] + includes + defines + [s_filename, fn]
|
||
|
- retcode = call(args)
|
||
|
+ retcode = call(shlex.split(CPP) + includes + defines + [s_filename, fn])
|
||
|
if (retcode != 0):
|
||
|
print "\"cpp includes s_filename\" failed"
|
||
|
usage()
|
||
|
- sys.exit(1)
|
||
|
+ return 1
|
||
|
s_filename = fn
|
||
|
if (filename == ""):
|
||
|
if (s_filename != ""):
|
||
|
@@ -236,15 +238,12 @@ def main():
|
||
|
filename = os.path.basename(filename)
|
||
|
else:
|
||
|
usage()
|
||
|
- sys.exit(1)
|
||
|
+ return 1
|
||
|
else:
|
||
|
- if (build_header):
|
||
|
- h_ext = ""
|
||
|
- else:
|
||
|
- (filename,ext) = os.path.splitext(filename)
|
||
|
+ suffix = ""
|
||
|
if (build_header):
|
||
|
providers = _provider()
|
||
|
- providers.generate(s_filename, filename + h_ext, add_typedefs)
|
||
|
+ providers.generate(s_filename, filename + suffix, add_typedefs)
|
||
|
elif (build_source):
|
||
|
(basename,ext) = os.path.splitext(s_filename)
|
||
|
|
||
|
@@ -265,9 +264,13 @@ def main():
|
||
|
f.close()
|
||
|
CC = os.environ.get("CC", "gcc")
|
||
|
CFLAGS = "-g " + os.environ.get("CFLAGS", "")
|
||
|
- call([CC, "-fPIC"] + defines + includes + CFLAGS.split() +
|
||
|
- ["-I.", "-I@prefix@/include", "-c", fn, "-o",
|
||
|
- filename + ".o"], shell=False)
|
||
|
+ retcode = call(shlex.split(CC) + defines + includes + shlex.split(CFLAGS) +
|
||
|
+ ["-fPIC", "-I.", "-I@prefix@/include", "-c", fn, "-o",
|
||
|
+ filename + suffix], shell=False)
|
||
|
+ if (retcode != 0):
|
||
|
+ print "\"gcc " + fn + "\" failed"
|
||
|
+ usage()
|
||
|
+ return 1
|
||
|
if (not keep_temps):
|
||
|
os.remove(fn)
|
||
|
else:
|
||
|
@@ -277,6 +280,7 @@ def main():
|
||
|
os.remove(s_filename)
|
||
|
else:
|
||
|
print "cpp: " + s_filename
|
||
|
+ return 0
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
- main()
|
||
|
+ sys.exit(main())
|
||
|
diff --git a/testsuite/systemtap.base/dtrace.exp b/testsuite/systemtap.base/dtrace.exp
|
||
|
index b301793..cd97c79 100644
|
||
|
--- a/testsuite/systemtap.base/dtrace.exp
|
||
|
+++ b/testsuite/systemtap.base/dtrace.exp
|
||
|
@@ -60,12 +60,12 @@ exec rm -f XXX.o
|
||
|
|
||
|
verbose -log "$dtrace -G -s $dpath -o XXX"
|
||
|
catch {exec $dtrace -G -s $dpath -o XXX}
|
||
|
-if {[file exists XXX.o]} then {
|
||
|
+if {[file exists XXX]} then {
|
||
|
pass "dtrace -G -o XXX"
|
||
|
} else {
|
||
|
fail "dtrace -G -o XXX"
|
||
|
}
|
||
|
-exec rm -f XXX.o
|
||
|
+exec rm -f XXX
|
||
|
|
||
|
verbose -log "$dtrace -h -s $dpath -o XXX.h"
|
||
|
catch {exec $dtrace -h -s $dpath -o XXX.h}
|
||
|
@@ -96,12 +96,12 @@ exec rm -f /tmp/XXX.o
|
||
|
|
||
|
verbose -log "$dtrace -G -s $dpath -o /tmp/XXX"
|
||
|
catch {exec $dtrace -G -s $dpath -o /tmp/XXX}
|
||
|
-if {[file exists /tmp/XXX.o]} then {
|
||
|
- pass "dtrace -G -o /tmp/XXX.o"
|
||
|
+if {[file exists /tmp/XXX]} then {
|
||
|
+ pass "dtrace -G -o /tmp/XXX"
|
||
|
} else {
|
||
|
- fail "dtrace -G -o /tmp/XXX.o"
|
||
|
+ fail "dtrace -G -o /tmp/XXX"
|
||
|
}
|
||
|
-exec rm -f /tmp/XXX.o
|
||
|
+exec rm -f /tmp/XXX
|
||
|
|
||
|
verbose -log "$dtrace -h -s $dpath -o /tmp/XXX.h"
|
||
|
catch {exec $dtrace -h -s $dpath -o /tmp/XXX.h}
|