kopia lustrzana https://github.com/Hamlib/Hamlib
DejaGNU tests
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1515 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.0
rodzic
900e8f4960
commit
b8b048189e
|
@ -1,8 +1,6 @@
|
|||
|
||||
AUTOMAKE_OPTIONS = dejagnu
|
||||
|
||||
#DEJATOOL = rigctl testbcd
|
||||
RUNTESTDEFAULTFLAGS = --tool rigctl --srcdir $$srcdir/testsuite RIGCTL=`pwd`/rigctl TESTBCD=`pwd`/testbcd
|
||||
DEJATOOL = testfreq testbcd testloc rigctl
|
||||
|
||||
DISTCLEANFILES = rigctl.log rigctl.sum testbcd.log testbcd.sum
|
||||
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
# Copyright (C) 1997 - 2001 Free Software Foundation, Inc.
|
||||
|
||||
# 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 program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# hamlib-developer@lists.sourceforge.net
|
||||
|
||||
set RIGCTL "$srcdir/rigctl"
|
||||
|
||||
if ![info exists prompt] then {
|
||||
set prompt "Rig command: "
|
||||
}
|
||||
#
|
||||
# rigctl_version -- extract and print the version number of rigctl
|
||||
#
|
||||
|
||||
proc rigctl_version {} {
|
||||
global RIGCTL
|
||||
global prompt
|
||||
set tmp [exec $RIGCTL --version]
|
||||
regexp "Hamlib version *(\[^\n\]*)\n.*" $tmp tmp version
|
||||
clone_output "[which $RIGCTL] version $version\n"
|
||||
}
|
||||
#
|
||||
# rigctl_load -- loads the program
|
||||
#
|
||||
proc rigctl_load { arg } {
|
||||
#
|
||||
}
|
||||
|
||||
#
|
||||
# rigctl_exit -- quit and cleanup
|
||||
#
|
||||
proc rigctl_exit {} {
|
||||
send "quit\n"
|
||||
}
|
||||
|
||||
#
|
||||
# rigctl_start -- start rigctl running
|
||||
#
|
||||
proc rigctl_start {} {
|
||||
global RIGCTL
|
||||
global prompt
|
||||
global spawn_id
|
||||
global verbose
|
||||
|
||||
if { $verbose > 1 } {
|
||||
send_user "starting $RIGCTL\n"
|
||||
}
|
||||
spawn $RIGCTL
|
||||
expect {
|
||||
-re "No such file.*" { perror "Can't start $RIGCTL"; exit 1 }
|
||||
-re "$prompt$" { }
|
||||
#FIXME
|
||||
#-re "rig: dlsym\(initrigs_([^\)]*)\) failed.*" { perror "Can't find backend $expect_out(1,string)"; exit 1 }
|
||||
timeout { perror "Failed to spawn $RIGCTL (timeout)"; exit 1 }
|
||||
}
|
||||
}
|
||||
|
||||
rigctl_start
|
|
@ -0,0 +1,62 @@
|
|||
# Copyright (C) 1997 - 2001 Free Software Foundation, Inc.
|
||||
|
||||
# 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 program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# hamlib-developer@lists.sourceforge.net
|
||||
|
||||
set timeout 3
|
||||
#
|
||||
# expectations that clean up in case of error. Note that `$test' is
|
||||
# a purely local variable.
|
||||
#
|
||||
# The first of these is used to match any bad responses, and resynchronise
|
||||
# things by finding a prompt. The second is a timeout error, and shouldn't
|
||||
# ever be triggered.
|
||||
#
|
||||
expect_after {
|
||||
-re "\[^\n\r\]*$prompt$" {
|
||||
fail "$test (bad match)"
|
||||
if { $verbose > 0 } {
|
||||
regexp ".*\r\n(\[^\r\n\]+)(\[\r\n\])+$prompt$" \
|
||||
$expect_out(buffer) "" output
|
||||
send_user "\tUnmatched output: \"$output\"\n"
|
||||
}
|
||||
}
|
||||
timeout {
|
||||
fail "$test (timeout)"
|
||||
}
|
||||
}
|
||||
#
|
||||
# Here are the tests
|
||||
#
|
||||
set test "help"
|
||||
send "?\n"
|
||||
expect {
|
||||
-re "Commands \\(may not be available for this rig\\):.*$prompt$" { pass "$test" }
|
||||
}
|
||||
|
||||
set test "nocmd"
|
||||
send "\n"
|
||||
expect {
|
||||
-re "\\? for help, q to quit\\..*$prompt$" { pass "$test" }
|
||||
}
|
||||
|
||||
set test "info"
|
||||
send "\\get_info\n"
|
||||
expect {
|
||||
-re "Info:.*$prompt$" { pass "$test" }
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
# Copyright (C) 1997 - 2001 Free Software Foundation, Inc.
|
||||
|
||||
# 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 program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# hamlib-developer@lists.sourceforge.net
|
||||
|
||||
set TESTBCD "$srcdir/testbcd"
|
||||
|
||||
#
|
||||
# Here are the tests
|
||||
#
|
||||
|
||||
# BCD: 44,34,33,22,12
|
||||
# BCD: 12,22,33,34,44
|
||||
proc test_bcd { test freq digits bcdle bcdbe } {
|
||||
|
||||
global TESTBCD
|
||||
set tmp [exec $TESTBCD $freq $digits]
|
||||
|
||||
set pat ".*Little Endian mode\nFrequency: $freq\nBCD: $bcdle\nResult after recoding: $freq\n\nBig Endian mode\nFrequency: $freq\nBCD: $bcdbe\nResult after recoding: $freq$"
|
||||
if [regexp $pat $tmp] {
|
||||
pass "$test"
|
||||
} else {
|
||||
clone_output "Expected le: $bcdle, be: $bcdbe, got:\n$tmp"
|
||||
fail "$test"
|
||||
}
|
||||
}
|
||||
|
||||
test_bcd "10/10 digits" 1222333444 10 "44,34,33,22,12" "12,22,33,34,44"
|
||||
test_bcd "9/10 digits" 999666333 10 "33,63,66,99,09" "09,99,66,63,33"
|
||||
test_bcd "8/10 digits" 87666333 10 "33,63,66,87,00" "00,87,66,63,33"
|
||||
test_bcd "1/10 digit" 1 10 "01,00,00,00,00" "00,00,00,00,01"
|
||||
|
||||
# note the 10th digit which is undefined
|
||||
test_bcd "9/9 digits" 999666333 9 "33,63,66,99,.9" "99,96,66,33,3."
|
||||
test_bcd "8/9 digits" 87666333 9 "33,63,66,87,.0" "08,76,66,33,3."
|
||||
test_bcd "1/9 digit" 1 9 "01,00,00,00,.0" "00,00,00,00,1."
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
# Copyright (C) 1997 - 2001 Free Software Foundation, Inc.
|
||||
|
||||
# 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 program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# hamlib-developer@lists.sourceforge.net
|
||||
|
||||
set TESTFREQ "$srcdir/testfreq"
|
||||
|
||||
#
|
||||
# Here are the tests
|
||||
#
|
||||
|
||||
proc test_freq { test } {
|
||||
|
||||
global TESTFREQ
|
||||
set tmp [exec $TESTFREQ]
|
||||
|
||||
set pat ".*GHz.2. = 2000000000\nGHz.4. = 4000000000\nGHz.5. = 5000000000\nGHz.1.3. = 1300000000\nGHz.1.234567890. = 1234567890\nGHz.123.456789012. = 123456789012$"
|
||||
if [regexp $pat $tmp] {
|
||||
pass "$test"
|
||||
} else {
|
||||
clone_output "Expected GHz holding on >32bits, got:\n$tmp"
|
||||
fail "$test"
|
||||
puts $pat
|
||||
}
|
||||
}
|
||||
|
||||
test_freq ">32bit freq's"
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
# Copyright (C) 1997 - 2001 Free Software Foundation, Inc.
|
||||
|
||||
# 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 program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# hamlib-developer@lists.sourceforge.net
|
||||
|
||||
set TESTLOC "$srcdir/testloc"
|
||||
|
||||
#
|
||||
# Here are the tests
|
||||
#
|
||||
|
||||
# TODO: upcase locator
|
||||
proc test_loc1 { test loc } {
|
||||
|
||||
global TESTLOC
|
||||
set tmp [exec $TESTLOC $loc]
|
||||
|
||||
set pat "Locator1: $loc\n.*Recoded: $loc$"
|
||||
if [regexp $pat $tmp] {
|
||||
pass "$test"
|
||||
} else {
|
||||
clone_output "Expected locator: $loc, got:\n$tmp"
|
||||
fail "$test"
|
||||
}
|
||||
}
|
||||
|
||||
test_loc1 "Simple recorded loc" IN98EC
|
||||
test_loc1 "Simple recorded loc" EM19OV
|
||||
test_loc1 "Simple recorded loc" DM33DX
|
||||
test_loc1 "Simple recorded loc" IO93LA
|
||||
test_loc1 "Simple recorded loc" IO93MA
|
||||
test_loc1 "Simple recorded loc" IO93NA
|
||||
|
Ładowanie…
Reference in New Issue