From 5096a3c6208a392ea601466bb874a59fd51d95d2 Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Fri, 5 Jun 2020 16:05:45 -0500 Subject: Add "testsuite can call api" feature test API --- lib/framework.exp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib') diff --git a/lib/framework.exp b/lib/framework.exp index e6ce197..e0f2ee6 100644 --- a/lib/framework.exp +++ b/lib/framework.exp @@ -1019,10 +1019,30 @@ proc incr_count { name args } { proc testsuite { subcommand args } { if { $subcommand eq "file" } { testsuite_file $args + } elseif { $subcommand eq "can" } { + testsuite_can $args } else { error "unknown \"testsuite\" command: testsuite $subcommand $args" } } +namespace eval ::dejagnu {} + +# Feature test +# +proc testsuite_can { argv } { + verbose "entering testsuite can $argv" 3 + + if { [lrange $argv 0 1] eq "call api" } { + set call [lrange $argv 2 end] + set result [info exists ::dejagnu::apilist($call)] + } else { + error "unknown feature test: testsuite can $argv" + } + + verbose "leaving testsuite can: $result" 3 + return $result +} +array set ::dejagnu::apilist { {testsuite can call api} 1 } # Return a full file name in or near the testsuite # @@ -1075,3 +1095,4 @@ proc testsuite_file { argv } { verbose "leaving testsuite file: $result" 3 return $result } +array set ::dejagnu::apilist { {testsuite file} 1 } -- cgit v1.1