# DejaGnu tool init file for testing gpgv mock tests
-# Copyright (C) 2021 Jacob Bachmeyer
+# Copyright (C) 2021, 2022 Jacob Bachmeyer
#
# This file is part of a testsuite for the GNU FTP upload system.
#
set MINSMTPD [testsuite file -source -top lib exec minsmtpd.tcl]
set MOCKGPGV [testsuite file -source -top lib exec mockgpgv]
-set ::env(GNUPGHOME) [file join \
- [file dirname [testsuite file -object -top]] \
- test.tmp gpgv]
+set GNUPGHOME [file join \
+ [file dirname [testsuite file -object -top]] \
+ test.tmp gpgv]
+set ::env(GNUPGHOME) $GNUPGHOME
load_lib mockgpg.exp
close $chan
}
-proc mock_exit {} {}
+proc mock_exit {} {
+ catch {file delete [file join \
+ [file dirname [testsuite file -object -top]] \
+ test.tmp]}
+}
proc mock_version {} {}
# The mock tools do not have independent versions.
# Signature "verification" tests for GPG mock
-# Copyright (C) 2021 Jacob Bachmeyer
+# Copyright (C) 2021, 2022 Jacob Bachmeyer
#
# This file is part of a testsuite for the GNU FTP upload system.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-file mkdir $::env(GNUPGHOME)
+file mkdir $GNUPGHOME
-write_test_keyring [file join $::env(GNUPGHOME) dg1.gpg] {
+write_test_keyring [file join $GNUPGHOME dg1.gpg] {
{ id 1001 name {test 1-1} }
{ id 1002 name {test 1-2} }
{ id 1003 name {test 1-3} expires {+5 minutes} }
is revoked expired {5 minutes ago} }
}
-write_test_keyring [file join $::env(GNUPGHOME) dg2.gpg] {
+write_test_keyring [file join $GNUPGHOME dg2.gpg] {
{ id 1011 name {test 2-1 (primary)} }
{ id 1012 name {test 2-2 (subkey)} subkey-of 1011 }
{ id 1013 name {test 2-3 (subkey)} subkey-of 1011 expires {+5 minutes} }
eval $cmd $args
}
+# invoked by DejaGnu framework when a failure is recorded
+proc gpgv_count_failures {args } {
+ global gpgv_total_failure_count gpgv_local_failure_count
+ incr gpgv_total_failure_count
+ incr gpgv_local_failure_count
+}
+set local_record_procs(fail) gpgv_count_failures
+set gpgv_total_failure_count 0
+set gpgv_local_failure_count 0
+
# InitialCapital variable names may be used in the $expect block.
# The "test_dir" variable is also set for the $init block.
proc run_gpgv_test { Name stem keyrings exitCode init phases assess expect } {
[file dirname [testsuite file -object -top]] test.tmp]
file mkdir $test_dir
+ global gpgv_local_failure_count
+ set gpgv_local_failure_count 0
+
eval $init
array set A {}
}
}
}
+
+ if { $gpgv_local_failure_count == 0 } {
+ foreach scratchfile [list "${stem}" "${stem}.asc" "${stem}.sig"] {
+ file delete -- [file join $test_dir $scratchfile]
+ }
+ }
}
proc do_gpgv_test { Name stem keyrings exitCode signature assess expect } {
run_gpgv_test $Name $stem $keyrings $exitCode \
exp_continue
}
}
+
+#
+
+if { $gpgv_total_failure_count == 0 } {
+ file delete -force $GNUPGHOME
+}
+
+#EOF