summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/setup.py6
-rwxr-xr-xtest.py64
2 files changed, 24 insertions, 46 deletions
diff --git a/src/setup.py b/src/setup.py
index 22abfaf..501fd76 100644
--- a/src/setup.py
+++ b/src/setup.py
@@ -1,9 +1,9 @@
from distutils.core import setup, Extension
setup(
- name = "dmidecode",
- version = "1.0",
- description = "A python module rewrite of dmidecode",
+ name = "python-dmidecode",
+ version = "2.10",
+ description = "Python extension module for dmidecode"
author = "Nima Talebi",
author_email = "nima@autonomy.net.au",
url = "http://projects.autonomy.net.au/dmidecode/",
diff --git a/test.py b/test.py
index fbae7d8..157df5c 100755
--- a/test.py
+++ b/test.py
@@ -8,21 +8,6 @@ print "Importing module...",
import dmidecode
print "Done"
-#. Test all functions using /dev/mem...
-print "Testing bios...", len(dmidecode.bios()) and "Good" or "Failed"
-print "Testing system...", dmidecode.system() and "Good" or "Failed"
-print "Testing baseboard...", dmidecode.baseboard() and "Good" or "Failed"
-print "Testing chassis...", dmidecode.chassis() and "Good" or "Failed"
-print "Testing processor...", dmidecode.processor() and "Good" or "Failed"
-print "Testing memory...", dmidecode.memory() and "Good" or "Failed"
-print "Testing cache...", dmidecode.cache() and "Good" or "Failed"
-print "Testing connector...", dmidecode.connector() and "Good" or "Failed"
-print "Testing slot...", dmidecode.slot() and "Good" or "Failed"
-
-if os.path.exists("/tmp/foo"):
- print "Removing old file..."
- os.unlink("/tmp/foo")
-
print "Testing check for write permission on dump...",
print not dmidecode.dump() and "Good" or "Bad"
@@ -41,6 +26,9 @@ print dmidecode.dump() and "Good" or "Bad"
print "Testing that file was actually written...",
print os.path.exists("/tmp/foo") and "Yes" or "No"
+dmidecode.dump()
+os.unlink("/tmp/foo")
+
#print os.stat("/tmp/foo")
#. Now test get/set of memory device file...
@@ -49,33 +37,23 @@ print os.path.exists("/tmp/foo") and "Yes" or "No"
#print dmidecode.get_dev()
#. Test taking a dump...
-dmidecode.dump()
-
-for i in (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 126, 127):
- print "Testing...", i, len(dmidecode.type(i)), "Done"
-
-sys.exit(0)
-
-#. Test reading the dump...
-print "*** bios ***\n"; pprint(dmidecode.bios())
-print "*** system ***\n"; pprint(dmidecode.system())
-print "*** system ***\n"; pprint(dmidecode.system())
-print "*** baseboard ***\n"; pprint(dmidecode.baseboard())
-print "*** chassis ***\n"; pprint(dmidecode.chassis())
-print "*** processor ***\n"; pprint(dmidecode.processor())
-print "*** memory ***\n"; pprint(dmidecode.memory())
-print "*** cache ***\n"; pprint(dmidecode.cache())
-print "*** connector ***\n"; pprint(dmidecode.connector())
-print "*** slot ***\n"; pprint(dmidecode.slot())
-
-print "*** bios ***\n"; pprint(dmidecode.bios())
-print "*** system ***\n"; pprint(dmidecode.system())
-print "*** baseboard ***\n"; pprint(dmidecode.baseboard())
-print "*** chassis ***\n"; pprint(dmidecode.chassis())
-print "*** processor ***\n"; pprint(dmidecode.processor())
-print "*** memory ***\n"; pprint(dmidecode.memory())
-print "*** cache ***\n"; pprint(dmidecode.cache())
-print "*** connector ***\n"; pprint(dmidecode.connector())
-print "*** slot ***\n"; pprint(dmidecode.slot())
+#. Test all functions using /dev/mem...
+devices = [os.path.join("private", _) for _ in os.listdir("private")]
+devices.remove('private/.svn')
+devices.append("/dev/mem")
+for dev in devices:
+ sys.stdout.write(" * Testing %s..."%dmidecode.get_dev())
+ if dmidecode.set_dev(dev):
+ sys.stdout.write("...\n")
+ for section in ["bios", "system", "baseboard", "chassis", "processor", "memory", "cache", "connector", "slot"]:
+ sys.stdout.write(" * Testing %s..."%section)
+ output = getattr(dmidecode, section)
+ sys.stdout.write(output and "Done\n" or "FAILED\n")
+ for i in tuple(range(0, 42))+tuple(range(126, 128)):
+ sys.stdout.write(" * Testing...")
+ output = len(dmidecode.type(i))
+ sys.stdout.write(output and "Done (%d)\n"%i or "FAILED\n")
+ else:
+ sys.stdout.write("FAILED\n")