]> git.saurik.com Git - apple/xnu.git/blame - libkern/kxld/tests/loadtest.py
xnu-1456.1.26.tar.gz
[apple/xnu.git] / libkern / kxld / tests / loadtest.py
CommitLineData
b0d623f7
A
1#!/usr/bin/env python
2
3import sys
4from subprocess import call, Popen, PIPE
5
6kexts = []
7pipe = Popen("/usr/sbin/kextfind \( -l -and -x -and -arch i386 \)", shell=True, stdout=PIPE).stdout
8
9line = pipe.readline()
10while line:
11 kexts.append(line.strip())
12 line = pipe.readline()
13
14NULL = open("/dev/null")
15
16for kext in kexts:
17 try:
18 print "Processing", kext
19#cmd = "/sbin/kextload -ns /tmp/syms \"%s\"" % kext
20 cmd = "/sbin/kextload \"%s\"" % kext
21 kextload = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE)
22 for i in range(20):
23 kextload.stdin.write("0x1000\n");
24 retcode = kextload.wait()
25 if retcode < 0:
26 print >>sys.stderr, "*** kextload of %s was terminated by signal %d" % (kext, -retcode)
27 elif retcode > 0:
28 print >>sys.stderr, "*** kextload of %s failed with return code %d" % (kext, retcode)
29 except OSError, e:
30 print >>sys.stderr, "Execution failed:", e
31 sys.exit(1)
32