diff options
| author | NIIBE Yutaka <[email protected]> | 2025-10-17 02:27:03 +0000 |
|---|---|---|
| committer | NIIBE Yutaka <[email protected]> | 2025-10-17 02:27:03 +0000 |
| commit | 89f6537840310c06cacfb1e82b1d9382af830afd (patch) | |
| tree | 61c83d1dd3bd0937625e5984944476ef664b9aa8 | |
| parent | gpg: Take care about the prefix for Curve25519 encryption. (diff) | |
| download | gnupg-89f6537840310c06cacfb1e82b1d9382af830afd.tar.gz gnupg-89f6537840310c06cacfb1e82b1d9382af830afd.zip | |
tests:w32: Fix the add-recipeint test for Windows.
* tests/openpgp/add-recipient.scm (add-recipient): Use temporary file
REFERENCE, instead of hard-coded "reference".
(change-recipient): Likewise.
--
Fixes-commit: 60f5b901178b476447d8a2ece0945bd3696e5ec3
Fixes-commit: fde7315e33e797443f8bdb2b5d103a952cceb5fc
Signed-off-by: NIIBE Yutaka <[email protected]>
| -rw-r--r-- | tests/openpgp/add-recipient.scm | 80 |
1 files changed, 42 insertions, 38 deletions
diff --git a/tests/openpgp/add-recipient.scm b/tests/openpgp/add-recipient.scm index 7e6e68831..9f640329f 100644 --- a/tests/openpgp/add-recipient.scm +++ b/tests/openpgp/add-recipient.scm @@ -25,59 +25,63 @@ (define privkey2 "private-keys-v1.d/8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34.key") ;; Create encrypted copy of keys for key reimport -(call-check `(,@GPG --enarmor ,privkey1)) -(call-check `(,@GPG --enarmor ,privkey2)) +(call-check `(,@GPG --enarmor ,privkey1)) +(call-check `(,@GPG --enarmor ,privkey2)) (for-each-p "Checking add-recipient 0/2" (lambda (source) - (tr:do - (tr:open source) - (tr:gpg "" `( --encrypt --recipient ,usrname1)) - (tr:gpg "" `( --recipient ,usrname2 --add-recipient)) - (tr:write-to "reference") - ;; Make usr1's priv unavailable - (tr:unlink privkey1) - (tr:spawn "" `(,@GPG --output **out** --decrypt "reference")) - (tr:assert-identity source) - ;; Reset enviroment - (tr:spawn "" `(,@GPG -o ,privkey1 --dearmor ,(string-append privkey1 ".asc"))) ;;usrname1 - ) + (lettmp (reference) + (tr:do + (tr:open source) + (tr:gpg "" `( --encrypt --recipient ,usrname1)) + (tr:gpg "" `( --recipient ,usrname2 --add-recipient)) + (tr:write-to reference) + ;; Make usr1's priv unavailable + (tr:unlink privkey1) + (tr:spawn "" `(,@GPG --output **out** --decrypt ,reference)) + (tr:assert-identity source) + ;; Reset enviroment + (tr:spawn "" `(,@GPG -o ,privkey1 --dearmor ,(string-append privkey1 ".asc"))) ;;usrname1 + ) + ) ) (append all-files) ) (for-each-p "Checking change-recipient 1/2" (lambda (source) - (tr:do - ;; Encrypt to usr1 - (tr:open source) - (tr:gpg "" `( --encrypt --recipient ,usrname1)) + (lettmp (reference) + (tr:do + ;; Encrypt to usr1 + (tr:open source) + (tr:gpg "" `( --encrypt --recipient ,usrname1)) - ;; Change recipient to usr2 - (tr:gpg "" `( --recipient ,usrname2 --change-recipient)) - (tr:write-to "reference") + ;; Change recipient to usr2 + (tr:gpg "" `( --recipient ,usrname2 --change-recipient)) + (tr:write-to reference) - ;; Setup keys for check 1 - (tr:unlink privkey2) ;;Remove key usr2 + ;; Setup keys for check 1 + (tr:unlink privkey2) ;;Remove key usr2 - ;; Check if usr1 can still decrypt if yes fail - (tr:call-with-content - (lambda (c) - (assert(failed? (call-check `(,@GPG --output **out** --decrypt "reference")))) - ) - ) - ;; Setup keys for check 2 - (tr:spawn "" `(,@GPG -o ,privkey2 --dearmor ,(string-append privkey2 ".asc"))) ;;Add key usr2 - (tr:unlink privkey1) ;;Remove key usr1 + ;; Check if usr1 can still decrypt if yes fail + (tr:call-with-content + (lambda (c) + (assert(failed? (call-check `(,@GPG --output **out** --decrypt ,reference)))) + ) + ) + ;; Setup keys for check 2 + (tr:spawn "" `(,@GPG -o ,privkey2 --dearmor ,(string-append privkey2 ".asc"))) ;;Add key usr2 + (tr:unlink privkey1) ;;Remove key usr1 - ;; Check if usr2 can decrypt if no fail - (tr:spawn "" `(,@GPG --output **out** --decrypt "reference")) - (tr:assert-identity source) + ;; Check if usr2 can decrypt if no fail + (tr:spawn "" `(,@GPG --output **out** --decrypt ,reference)) + (tr:assert-identity source) - ;; Reset enviroment - (tr:spawn "" `(,@GPG -o ,privkey1 --dearmor ,(string-append privkey1 ".asc"))) ;;Add key usr1 - ) + ;; Reset enviroment + (tr:spawn "" `(,@GPG -o ,privkey1 --dearmor ,(string-append privkey1 ".asc"))) ;;Add key usr1 + ) + ) ) (append all-files) ) |
