summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blossom2010-11-05 21:58:58 -0700
committerEric Blossom2010-11-10 12:17:57 -0800
commita79986e0a88632029daf2dad5d05518d33bb1866 (patch)
tree6bc47fa158e0585e8626aa11ecd596125ed133f6
parent53c6be5b6bdca4fe93b9034cb0b34eaa274af9d9 (diff)
downloadgnuradio-a79986e0a88632029daf2dad5d05518d33bb1866.tar.gz
gnuradio-a79986e0a88632029daf2dad5d05518d33bb1866.tar.bz2
gnuradio-a79986e0a88632029daf2dad5d05518d33bb1866.zip
First real guile QA code
-rw-r--r--gnuradio-core/src/guile/Makefile.am4
-rw-r--r--gnuradio-core/src/guile/qa_0000_basics.scm82
-rw-r--r--gnuradio-core/src/guile/qa_stub.scm0
-rw-r--r--gnuradio-core/src/guile/srfi/srfi-64.scm (renamed from guile/srfi/srfi-64.scm)2
-rw-r--r--run_guile_tests.sh.in7
5 files changed, 89 insertions, 6 deletions
diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am
index 3c21373af..ef6ab0b7e 100644
--- a/gnuradio-core/src/guile/Makefile.am
+++ b/gnuradio-core/src/guile/Makefile.am
@@ -34,5 +34,5 @@ nobase_guile_DATA = \
Swig/common.scm \
gnuradio/core.scm \
gnuradio/export-safely.scm \
- gnuradio/runtime-shim.scm
-
+ gnuradio/runtime-shim.scm \
+ srfi/srfi-64.scm
diff --git a/gnuradio-core/src/guile/qa_0000_basics.scm b/gnuradio-core/src/guile/qa_0000_basics.scm
new file mode 100644
index 000000000..19bde0589
--- /dev/null
+++ b/gnuradio-core/src/guile/qa_0000_basics.scm
@@ -0,0 +1,82 @@
+(use-modules (gnuradio core))
+(use-modules (oop goops))
+
+(load-from-path "srfi/srfi-64")
+(use-modules (ice-9 format))
+(use-modules (ice-9 pretty-print))
+
+;; (write "Hello QA world!\n")
+
+(define (vector-map f v)
+ (list->vector (map f (vector->list v))))
+
+(define (test-1)
+ (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5))
+ (expected-result (vector-map (lambda (x) (* x 2)) src-data))
+ (tb (gr:top-block-swig "my top block"))
+ (src (gr:vector-source-i src-data #f))
+ (op (gr:multiply-const-ii 2))
+ (dst (gr:vector-sink-i)))
+
+ ;; using gr:ep to create endpoints
+ (gr:connect tb (gr:ep src 0) (gr:ep op 0))
+ (gr:connect tb (gr:ep op 0) (gr:ep dst 0))
+
+ (gr:run tb)
+ (let ((actual-result (gr:data dst)))
+ (test-equal expected-result actual-result))))
+
+(define (test-2)
+ (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5))
+ (expected-result (vector-map (lambda (x) (* x 2)) src-data))
+ (tb (gr:top-block-swig "my top block"))
+ (src (gr:vector-source-i src-data #f))
+ (op (gr:multiply-const-ii 2))
+ (dst (gr:vector-sink-i)))
+
+ ;; using just blocks
+ (gr:connect tb src op)
+ (gr:connect tb op dst)
+
+ (gr:run tb)
+ (let ((actual-result (gr:data dst)))
+ (test-equal expected-result actual-result))))
+
+(define (test-3)
+ (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5))
+ (expected-result (vector-map (lambda (x) (* x 2)) src-data))
+ (tb (gr:top-block-swig "my top block"))
+ (src (gr:vector-source-i src-data #f))
+ (op (gr:multiply-const-ii 2))
+ (dst (gr:vector-sink-i)))
+
+ ;; using lists to represent endpoints
+ (gr:connect tb `(,src 0) `(,op 0))
+ (gr:connect tb `(,op 0) `(,dst 0))
+
+ (gr:run tb)
+ (let ((actual-result (gr:data dst)))
+ (test-equal expected-result actual-result))))
+
+(define (test-4)
+ (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5))
+ (expected-result (vector-map (lambda (x) (* x 2)) src-data))
+ (tb (gr:top-block-swig "my top block"))
+ (src (gr:vector-source-i src-data #f))
+ (op (gr:multiply-const-ii 2))
+ (dst (gr:vector-sink-i)))
+
+ ;; using multiple endpoints
+ (gr:connect tb src op dst)
+
+ (gr:run tb)
+ (let ((actual-result (gr:data dst)))
+ (test-equal expected-result actual-result))))
+
+
+(test-begin "qa_0000_basics")
+(test-1)
+(test-2)
+(test-3)
+(test-4)
+(test-end "qa_0000_basics")
diff --git a/gnuradio-core/src/guile/qa_stub.scm b/gnuradio-core/src/guile/qa_stub.scm
deleted file mode 100644
index e69de29bb..000000000
--- a/gnuradio-core/src/guile/qa_stub.scm
+++ /dev/null
diff --git a/guile/srfi/srfi-64.scm b/gnuradio-core/src/guile/srfi/srfi-64.scm
index 4ad9ccbab..25833b3f7 100644
--- a/guile/srfi/srfi-64.scm
+++ b/gnuradio-core/src/guile/srfi/srfi-64.scm
@@ -189,7 +189,7 @@
;; Not part of the specification. FIXME
;; Controls whether a log file is generated.
-(define test-log-to-file #t)
+(define test-log-to-file #f)
(define (test-runner-simple)
(let ((runner (%test-runner-alloc)))
diff --git a/run_guile_tests.sh.in b/run_guile_tests.sh.in
index d0dc554fe..269365775 100644
--- a/run_guile_tests.sh.in
+++ b/run_guile_tests.sh.in
@@ -62,14 +62,15 @@ echo $0: FIXME add stuff from args 1>&2
# ------------------------------------------------------------------------
-echo "mylibdir = $mylibdir"
-echo "guile_load_path = $guile_load_path"
+#echo "mylibdir = $mylibdir"
+#echo "guile_load_path = $guile_load_path"
prepend LTDL_LIBRARY_PATH "$mylibdir"
prepend GUILE_LOAD_PATH "$guile_load_path"
export LTDL_LIBRARY_PATH
export GUILE_LOAD_PATH
+export GUILE_WARN_DEPRECATED=no
# Run everything that matches qa_*.scm and return the final result.
@@ -77,7 +78,7 @@ ok=yes
for file in $4/qa_*.scm
do
# echo $file
- @GUILE@ $file
+ @GUILE@ -s $file
r=$?
if [ $r -ne 0 ]
then