From: Jacob Bachmeyer Date: Tue, 20 Sep 2022 00:04:12 +0000 (-0500) Subject: Improve handling of test environments in upload testsuite X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7d41424701c3abee344b7698c5c482905445c7e2;p=gatekeeper.git Improve handling of test environments in upload testsuite This removes the argument to the new_test_environment procedure. --- diff --git a/testsuite/lib/upload.exp b/testsuite/lib/upload.exp index 93654f5..f1cbfd9 100644 --- a/testsuite/lib/upload.exp +++ b/testsuite/lib/upload.exp @@ -1,6 +1,6 @@ # DejaGnu tool init file for GNU FTP upload handler 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. # @@ -26,6 +26,10 @@ set DIRECTIVE_FORMAT_VERSIONS { 1.1 1.2 } # Make sure to add a test in 03_triplet.exp whenever one of these is # removed to confirm that it is considered invalid. +set TEST_BASE [file join \ + [file dirname [testsuite file -object -top]] test.tmp] +set TENV_STEM [file join $TEST_BASE tenv] + # invoked by DejaGnu framework when a failure is recorded proc upload_count_failures { args } { global upload_failure_count @@ -53,8 +57,9 @@ proc new_work_area { stem } { return $name } -proc new_test_environment { stem } { - set name [new_work_area $stem] +proc new_test_environment { } { + global TENV_STEM + set name [new_work_area $TENV_STEM] global upload_failure_count set upload_failure_count 0 @@ -988,7 +993,8 @@ proc analyze_mail { base_dir name args } { proc upload_exit {} { # clean up test environment tree - catch {file delete -- test.tmp} + global TEST_BASE + catch {file delete -- $TEST_BASE} } proc upload_version {} { global UPLOAD_TOOL diff --git a/testsuite/upload.all/00_idle.exp b/testsuite/upload.all/00_idle.exp index 9730c52..75bd000 100644 --- a/testsuite/upload.all/00_idle.exp +++ b/testsuite/upload.all/00_idle.exp @@ -1,6 +1,6 @@ # Tests for processing with nothing to do -# Copyright (C) 2021 Jacob Bachmeyer +# Copyright (C) 2021, 2022 Jacob Bachmeyer # # This file is part of a testsuite for the GNU FTP upload system. # @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -set tenv [new_test_environment [file join test.tmp tenv]] +set tenv [new_test_environment] start_test_services $tenv run_upload_batch_test @@ -38,7 +38,7 @@ close_test_environment $tenv # ---------------------------------------- -set tenv [new_test_environment [file join test.tmp tenv]] +set tenv [new_test_environment] # files which are to be found in the scan but not processed put_file [file join $tenv incoming bogus1] "bogus file 1\n" @@ -118,7 +118,7 @@ close_test_environment $tenv # ---------------------------------------- proc check_incomplete_upload { has_directive has_main has_signature } { - set tenv [new_test_environment [file join test.tmp tenv]] + set tenv [new_test_environment] put_file [file join $tenv mocks] ":^ lsof -Fn .*\n? 1\n" @@ -190,7 +190,7 @@ check_incomplete_upload 1 1 0 # ---------------------------------------- proc check_ongoing_upload { open_directive open_main open_signature } { - set tenv [new_test_environment [file join test.tmp tenv]] + set tenv [new_test_environment] set msglist { start "ftp-upload start message" @@ -278,7 +278,7 @@ check_ongoing_upload 0 0 1 # ---------------------------------------- proc check_recent_upload { recent_directive recent_main recent_signature } { - set tenv [new_test_environment [file join test.tmp tenv]] + set tenv [new_test_environment] set msglist { start "ftp-upload start message" @@ -350,7 +350,7 @@ check_recent_upload 0 0 1 # ---------------------------------------- proc check_oversize_part { oversize_directive oversize_signature } { - set tenv [new_test_environment [file join test.tmp tenv]] + set tenv [new_test_environment] set msglist { start "ftp-upload start message" diff --git a/testsuite/upload.all/01_loose.exp b/testsuite/upload.all/01_loose.exp index f2801bd..4540aed 100644 --- a/testsuite/upload.all/01_loose.exp +++ b/testsuite/upload.all/01_loose.exp @@ -1,6 +1,6 @@ # Tests for processing standalone directives -# Copyright (C) 2021 Jacob Bachmeyer +# Copyright (C) 2021, 2022 Jacob Bachmeyer # # This file is part of a testsuite for the GNU FTP upload system. # @@ -18,7 +18,7 @@ # along with this program. If not, see . proc check_loose_directive { desc case args } { - set tenv [new_test_environment [file join test.tmp tenv]] + set tenv [new_test_environment] array set opt { initial-files {} initial-symlinks {} diff --git a/testsuite/upload.all/03_triplet.exp b/testsuite/upload.all/03_triplet.exp index 5a95f6b..1f3b1f5 100644 --- a/testsuite/upload.all/03_triplet.exp +++ b/testsuite/upload.all/03_triplet.exp @@ -18,7 +18,7 @@ # along with this program. If not, see . proc check_triplet { desc args } { - set tenv [new_test_environment [file join test.tmp tenv]] + set tenv [new_test_environment] array set data { setup {} upload {} check {} } array set data $args diff --git a/testsuite/upload.all/11_am_cve.exp b/testsuite/upload.all/11_am_cve.exp index 9f1548a..9df83dc 100644 --- a/testsuite/upload.all/11_am_cve.exp +++ b/testsuite/upload.all/11_am_cve.exp @@ -46,7 +46,7 @@ proc check_am_cve_upload {desc fragment {log {}}} { } if { [llength $log] > 0 } { append log_items $log } - set tenv [new_test_environment [file join test.tmp tenv]] + set tenv [new_test_environment] register_test_packages $tenv { foo {