X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/e2fac8b15b12a7979f72090454d850e612fc5b13..b0d623f7f2ae71ed96e60569f61f9a9a27016e80:/libkern/kxld/tests/loadtest.py diff --git a/libkern/kxld/tests/loadtest.py b/libkern/kxld/tests/loadtest.py new file mode 100644 index 000000000..def56cfed --- /dev/null +++ b/libkern/kxld/tests/loadtest.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +import sys +from subprocess import call, Popen, PIPE + +kexts = [] +pipe = Popen("/usr/sbin/kextfind \( -l -and -x -and -arch i386 \)", shell=True, stdout=PIPE).stdout + +line = pipe.readline() +while line: + kexts.append(line.strip()) + line = pipe.readline() + +NULL = open("/dev/null") + +for kext in kexts: + try: + print "Processing", kext +#cmd = "/sbin/kextload -ns /tmp/syms \"%s\"" % kext + cmd = "/sbin/kextload \"%s\"" % kext + kextload = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE) + for i in range(20): + kextload.stdin.write("0x1000\n"); + retcode = kextload.wait() + if retcode < 0: + print >>sys.stderr, "*** kextload of %s was terminated by signal %d" % (kext, -retcode) + elif retcode > 0: + print >>sys.stderr, "*** kextload of %s failed with return code %d" % (kext, retcode) + except OSError, e: + print >>sys.stderr, "Execution failed:", e + sys.exit(1) +