From: Jaroslav Kysela Date: Mon, 26 Feb 2007 14:27:39 +0000 (+0100) Subject: moved test code to test directory X-Git-Tag: v1.0.14rc4~2 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=95ca676ccd07841fc6642c04ef753d7b5542c6b8;p=alsa-python.git moved test code to test directory --- diff --git a/.hgignore b/.hgignore index b5a0cbd..d5c655d 100644 --- a/.hgignore +++ b/.hgignore @@ -1,8 +1,12 @@ syntax: glob build/* +dist/* old/* *~ .*~ *.orig *.rej +*.pyc +MANIFEST +version diff --git a/MANIFEST.in b/MANIFEST.in index 6de36fa..694303d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ +include test/*.py include utils/*.py diff --git a/test/alsamemdebug.py b/test/alsamemdebug.py new file mode 100644 index 0000000..4e5cd7f --- /dev/null +++ b/test/alsamemdebug.py @@ -0,0 +1,19 @@ +#! /usr/bin/python +# -*- Python -*- + +import sys +import gc + +def debuginit(): + gc.set_debug(gc.DEBUG_LEAK) + +def debug(what): + from sys import getrefcount + from gc import get_referrers + for o in what: + if getrefcount(o) - 3 != 1 or \ + len(get_referrers(o)) - 2 != 1: + print 'LEAK:', hex(id(o)), type(o), getrefcount(o)-3, len(get_referrers(o))-2 + +def debugdone(): + None diff --git a/pyalsa/cardtest1.py b/test/cardtest1.py similarity index 88% rename from pyalsa/cardtest1.py rename to test/cardtest1.py index 9b19290..8c2eba7 100755 --- a/pyalsa/cardtest1.py +++ b/test/cardtest1.py @@ -1,6 +1,9 @@ #! /usr/bin/python # -*- Python -*- +import sys +sys.path.insert(0, '../pyalsa') +del sys import alsacard print 'asoundlibVersion:', alsacard.asoundlibVersion() diff --git a/pyalsa/hctltest1.py b/test/hctltest1.py similarity index 97% rename from pyalsa/hctltest1.py rename to test/hctltest1.py index 1bd80a3..d656b78 100755 --- a/pyalsa/hctltest1.py +++ b/test/hctltest1.py @@ -1,6 +1,9 @@ #! /usr/bin/python # -*- Python -*- +import sys +sys.path.insert(0, '../pyalsa') +del sys import alsahcontrol def info(element): diff --git a/pyalsa/hctltest2.py b/test/hctltest2.py similarity index 97% rename from pyalsa/hctltest2.py rename to test/hctltest2.py index 052df50..7a255a5 100755 --- a/pyalsa/hctltest2.py +++ b/test/hctltest2.py @@ -1,6 +1,9 @@ #! /usr/bin/python # -*- Python -*- +import sys +sys.path.insert(0, '../pyalsa') +del sys import select import alsahcontrol diff --git a/pyalsa/mixertest1.py b/test/mixertest1.py similarity index 91% rename from pyalsa/mixertest1.py rename to test/mixertest1.py index efe00c9..e3d8948 100755 --- a/pyalsa/mixertest1.py +++ b/test/mixertest1.py @@ -1,6 +1,10 @@ #! /usr/bin/python # -*- Python -*- +import sys +sys.path.insert(0, '../pyalsa') +del sys +from alsamemdebug import debuginit, debug, debugdone import alsamixer def print_elem(e): @@ -28,6 +32,8 @@ def print_elem(e): if e.hasChannel(channel, capture): print ' has%sChannel%s: %s' % (direction[capture], channel, alsamixer.ChannelName[channel]) +debuginit() + print 'ChannelId:' print alsamixer.ChannelId @@ -52,4 +58,10 @@ element = alsamixer.Element(mixer, "PCM") element.setVolumeTuple((128, 128)) print_elem(element) print_elem(alsamixer.Element(mixer, "Off-hook")) + +debug([element]) +del element +debug([mixer]) del mixer + +debugdone() diff --git a/pyalsa/mixertest2.py b/test/mixertest2.py similarity index 95% rename from pyalsa/mixertest2.py rename to test/mixertest2.py index bd69cf6..24e5605 100755 --- a/pyalsa/mixertest2.py +++ b/test/mixertest2.py @@ -1,6 +1,9 @@ #! /usr/bin/python # -*- Python -*- +import sys +sys.path.insert(0, '../pyalsa') +del sys import alsamixer import select