]> git.alsa-project.org Git - alsa-python.git/commitdiff
moved test code to test directory
authorJaroslav Kysela <perex@perex.cz>
Mon, 26 Feb 2007 14:27:39 +0000 (15:27 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 26 Feb 2007 14:27:39 +0000 (15:27 +0100)
.hgignore
MANIFEST.in
test/alsamemdebug.py [new file with mode: 0644]
test/cardtest1.py [moved from pyalsa/cardtest1.py with 88% similarity]
test/hctltest1.py [moved from pyalsa/hctltest1.py with 97% similarity]
test/hctltest2.py [moved from pyalsa/hctltest2.py with 97% similarity]
test/mixertest1.py [moved from pyalsa/mixertest1.py with 91% similarity]
test/mixertest2.py [moved from pyalsa/mixertest2.py with 95% similarity]

index b5a0cbd13b95d06b6f550cf5af1a3e5fbe416a66..d5c655d2d8b70642362ab3add6bd9eaca51d3cf8 100644 (file)
--- a/.hgignore
+++ b/.hgignore
@@ -1,8 +1,12 @@
 syntax: glob
 
 build/*
+dist/*
 old/*
 *~
 .*~
 *.orig
 *.rej
+*.pyc
+MANIFEST
+version
index 6de36fa78afd38fa018cf56d46e0b98ad3786ebc..694303d099428d4c7fba7c7ec95acf392e498110 100644 (file)
@@ -1 +1,2 @@
+include test/*.py
 include utils/*.py
diff --git a/test/alsamemdebug.py b/test/alsamemdebug.py
new file mode 100644 (file)
index 0000000..4e5cd7f
--- /dev/null
@@ -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
similarity index 88%
rename from pyalsa/cardtest1.py
rename to test/cardtest1.py
index 9b192909839105b558f4679fc840c78f71f258df..8c2eba76b59c9dd94840a7f104ff4c09181d6f9b 100755 (executable)
@@ -1,6 +1,9 @@
 #! /usr/bin/python
 # -*- Python -*-
 
+import sys
+sys.path.insert(0, '../pyalsa')
+del sys
 import alsacard
 
 print 'asoundlibVersion:', alsacard.asoundlibVersion()
similarity index 97%
rename from pyalsa/hctltest1.py
rename to test/hctltest1.py
index 1bd80a3c34046dd25aa18f2235cb9534cf6b6245..d656b789035329f167ba7af63c8f46a56634fad1 100755 (executable)
@@ -1,6 +1,9 @@
 #! /usr/bin/python
 # -*- Python -*-
 
+import sys
+sys.path.insert(0, '../pyalsa')
+del sys
 import alsahcontrol
 
 def info(element):
similarity index 97%
rename from pyalsa/hctltest2.py
rename to test/hctltest2.py
index 052df50da2d5b66a394ffce58a6d7d803d9a23b4..7a255a530562f44efae003d34ead66d43bea9165 100755 (executable)
@@ -1,6 +1,9 @@
 #! /usr/bin/python
 # -*- Python -*-
 
+import sys
+sys.path.insert(0, '../pyalsa')
+del sys
 import select
 import alsahcontrol
 
similarity index 91%
rename from pyalsa/mixertest1.py
rename to test/mixertest1.py
index efe00c9ba0d910b24ebf316490e8737ced11c55a..e3d894800d0b58842268b4c6f06cced361d39acf 100755 (executable)
@@ -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()
similarity index 95%
rename from pyalsa/mixertest2.py
rename to test/mixertest2.py
index bd69cf6d6866602bef5e0a5076d3d2626b931ffe..24e5605a931e3707c422621604d6cab8c47650e6 100755 (executable)
@@ -1,6 +1,9 @@
 #! /usr/bin/python
 # -*- Python -*-
 
+import sys
+sys.path.insert(0, '../pyalsa')
+del sys
 import alsamixer
 import select