From ea7bb44fc527bfab6b418ad6fd0e5cf87341298e Mon Sep 17 00:00:00 2001 From: nima Date: Sun, 21 Dec 2008 10:22:06 +0000 Subject: Cleanup copyright. Cleanup debian/rules. Adding test.py to examples. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@158 abc39116-655e-4be6-ad55-d661dc543056 --- debian/copyright | 25 ++++++++++++-- debian/rules | 5 +-- examples/test.py | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ test.py | 103 ------------------------------------------------------- 4 files changed, 127 insertions(+), 109 deletions(-) create mode 100755 examples/test.py delete mode 100755 test.py diff --git a/debian/copyright b/debian/copyright index fbf7852..5a5edda 100644 --- a/debian/copyright +++ b/debian/copyright @@ -15,7 +15,11 @@ Upstream Author: Nima Talebi The Debian packaging is (C) 2008, Nima Talebi and is licensed under the GPL, see `/usr/share/common-licenses/GPL'. -License: GPLv3 +License: + GPLv3 - The python-dmidecode packages is available under the terms of + the GNU General Public license version 3. On Debian systems, the complete + text of the GNU General Public License can be found in + `/usr/share/common-licenses/GPL'. DMIDecode @@ -32,4 +36,21 @@ Copyrights ========== Copyright 2000-2002 Alan Cox Copyright 2002-2008 Jean Delvare -Copyright 2008 Nima Talebi +Copyright 2007-2008 Nma Talebi + +License: + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + diff --git a/debian/rules b/debian/rules index 65d8e77..5fcfc15 100755 --- a/debian/rules +++ b/debian/rules @@ -1,10 +1,8 @@ #!/usr/bin/make -f -export DH_VERBOSE=1 - +#export DH_VERBOSE=1 PYDEF = $(shell pyversions -d) PYVERS = $(shell pyversions -r) -PYVERS = python2.4 python2.5 ############# @@ -55,7 +53,6 @@ binary-arch: build install # dh_pysupport dh_pycentral dh_installman - dh_link dh_strip dh_compress dh_fixperms diff --git a/examples/test.py b/examples/test.py new file mode 100755 index 0000000..699a0bf --- /dev/null +++ b/examples/test.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python +#.awk '$0 ~ /case [0-9]+: .. 3/ { sys.stdout.write($2 }' src/dmidecode.c|tr ':\n' ', ' + +from pprint import pprint +import os, sys, random, tempfile, time + +FH, DUMP = tempfile.mkstemp() +os.unlink(DUMP) +os.close(FH) + +total = 0 +success = 0 + +def test(r): + global total + global success + + total += 1 + if r: + sys.stdout.write("Good\n") + success += 1 + return True + else: + sys.stdout.write("FAILED\n") + return False + +total += 1 +print "-"*80 +sys.stdout.write("Importing module...") +try: + import dmidecode + success += 1 + sys.stdout.write("Done\n") + sys.stdout.write(" * Version: %s\n"%dmidecode.version) + sys.stdout.write(" * DMI Version String: %s\n"%dmidecode.dmi) + + print "-"*80 + sys.stdout.write("Testing that default device is /dev/mem...") + test(dmidecode.get_dev() == "/dev/mem") + + sys.stdout.write("Testing that write-lock will not break on dump()...") + test(not dmidecode.dump()) + + sys.stdout.write("Testing ability to change device to %s..."%DUMP) + test(dmidecode.set_dev(DUMP)) + + sys.stdout.write("Testing that device has changed to %s..."%DUMP) + test(dmidecode.get_dev() == DUMP) + + sys.stdout.write("Testing that write on new file is ok...") + test(dmidecode.dump()) + + sys.stdout.write("Testing that file was actually written...") + time.sleep(0.1) + test(os.path.exists(DUMP)) + os.unlink(DUMP) + + types = range(0, 42)+range(126, 128) + bad_types = [-1, -1000, 256] + sections = ["bios", "system", "baseboard", "chassis", "processor", "memory", "cache", "connector", "slot"] + devices = [] + if os.path.exists("private"): + devices.extend([os.path.join("private", _) for _ in os.listdir("private")]) + devices.remove('private/.svn') + else: + sys.stdout.write("If you have memory dumps to test, create a directory called `private' and drop them in there.\n") + devices.append("/dev/mem") + random.shuffle(types) + random.shuffle(devices) + random.shuffle(sections) + + for dev in devices: + sys.stdout.write(" * Testing %s..."%dev); sys.stdout.flush() + if test(dmidecode.set_dev(dev) and dmidecode.get_dev() == dev): + print "-"*80 + print sections + for section in sections: + sys.stdout.write(" * Testing %s..."%section); sys.stdout.flush() + output = getattr(dmidecode, section)() + test(output is not False) + if output: sys.stdout.write(" * %s\n"%output.keys()) + + print "-"*80 + for i in bad_types: + sys.stdout.write(" * Testing bad type %i..."%i); sys.stdout.flush() + try: + output = dmidecode.type(i) + test(output is False) + except SystemError: + sys.stdout.write("FAILED\n") + + print "-"*80 + for i in types: + sys.stdout.write(" * Testing type %i..."%i); sys.stdout.flush() + output = dmidecode.type(i) + test(output is not False) + if output: + sys.stdout.write(" * %s\n"%output.keys()) + +except ImportError: + sys.stdout.write("FAILED\n") + +sys.stdout.write("Score: %d/%d\n"%(success, total)) diff --git a/test.py b/test.py deleted file mode 100755 index 699a0bf..0000000 --- a/test.py +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env python -#.awk '$0 ~ /case [0-9]+: .. 3/ { sys.stdout.write($2 }' src/dmidecode.c|tr ':\n' ', ' - -from pprint import pprint -import os, sys, random, tempfile, time - -FH, DUMP = tempfile.mkstemp() -os.unlink(DUMP) -os.close(FH) - -total = 0 -success = 0 - -def test(r): - global total - global success - - total += 1 - if r: - sys.stdout.write("Good\n") - success += 1 - return True - else: - sys.stdout.write("FAILED\n") - return False - -total += 1 -print "-"*80 -sys.stdout.write("Importing module...") -try: - import dmidecode - success += 1 - sys.stdout.write("Done\n") - sys.stdout.write(" * Version: %s\n"%dmidecode.version) - sys.stdout.write(" * DMI Version String: %s\n"%dmidecode.dmi) - - print "-"*80 - sys.stdout.write("Testing that default device is /dev/mem...") - test(dmidecode.get_dev() == "/dev/mem") - - sys.stdout.write("Testing that write-lock will not break on dump()...") - test(not dmidecode.dump()) - - sys.stdout.write("Testing ability to change device to %s..."%DUMP) - test(dmidecode.set_dev(DUMP)) - - sys.stdout.write("Testing that device has changed to %s..."%DUMP) - test(dmidecode.get_dev() == DUMP) - - sys.stdout.write("Testing that write on new file is ok...") - test(dmidecode.dump()) - - sys.stdout.write("Testing that file was actually written...") - time.sleep(0.1) - test(os.path.exists(DUMP)) - os.unlink(DUMP) - - types = range(0, 42)+range(126, 128) - bad_types = [-1, -1000, 256] - sections = ["bios", "system", "baseboard", "chassis", "processor", "memory", "cache", "connector", "slot"] - devices = [] - if os.path.exists("private"): - devices.extend([os.path.join("private", _) for _ in os.listdir("private")]) - devices.remove('private/.svn') - else: - sys.stdout.write("If you have memory dumps to test, create a directory called `private' and drop them in there.\n") - devices.append("/dev/mem") - random.shuffle(types) - random.shuffle(devices) - random.shuffle(sections) - - for dev in devices: - sys.stdout.write(" * Testing %s..."%dev); sys.stdout.flush() - if test(dmidecode.set_dev(dev) and dmidecode.get_dev() == dev): - print "-"*80 - print sections - for section in sections: - sys.stdout.write(" * Testing %s..."%section); sys.stdout.flush() - output = getattr(dmidecode, section)() - test(output is not False) - if output: sys.stdout.write(" * %s\n"%output.keys()) - - print "-"*80 - for i in bad_types: - sys.stdout.write(" * Testing bad type %i..."%i); sys.stdout.flush() - try: - output = dmidecode.type(i) - test(output is False) - except SystemError: - sys.stdout.write("FAILED\n") - - print "-"*80 - for i in types: - sys.stdout.write(" * Testing type %i..."%i); sys.stdout.flush() - output = dmidecode.type(i) - test(output is not False) - if output: - sys.stdout.write(" * %s\n"%output.keys()) - -except ImportError: - sys.stdout.write("FAILED\n") - -sys.stdout.write("Score: %d/%d\n"%(success, total)) -- cgit