From 9cdc2bf61c0d9bffa33567964aeff090cb34b6ec Mon Sep 17 00:00:00 2001 From: "Commentator2.0" Date: Thu, 21 Aug 2025 19:11:30 +0200 Subject: [PATCH] tests/functional2: migrate hash.sh Change-Id: I5061479b972088c904ca1db4d9004e738c2b5a57 --- tests/functional/hash.sh | 107 -------------- tests/functional/meson.build | 1 - .../test_hash/_md5_--base16_False.out.exp | 1 + .../test_hash/_md5_--base16_True.out.exp | 1 + .../test_hash/_md5_--base32_False.out.exp | 1 + .../test_hash/_md5_--base32_True.out.exp | 1 + .../assets/test_hash/_md5_--sri_False.out.exp | 1 + .../assets/test_hash/_md5_--sri_True.out.exp | 1 + .../test_hash/_sha1_--base16_False.out.exp | 1 + .../test_hash/_sha1_--base16_True.out.exp | 1 + .../test_hash/_sha1_--base32_False.out.exp | 1 + .../test_hash/_sha1_--base32_True.out.exp | 1 + .../test_hash/_sha1_--sri_False.out.exp | 1 + .../assets/test_hash/_sha1_--sri_True.out.exp | 1 + .../test_hash/_sha256_--base16_False.out.exp | 1 + .../test_hash/_sha256_--base16_True.out.exp | 1 + .../test_hash/_sha256_--base32_False.out.exp | 1 + .../test_hash/_sha256_--base32_True.out.exp | 1 + .../test_hash/_sha256_--sri_False.out.exp | 1 + .../test_hash/_sha256_--sri_True.out.exp | 1 + .../test_hash/_sha512_--base16_False.out.exp | 1 + .../test_hash/_sha512_--base16_True.out.exp | 1 + .../test_hash/_sha512_--base32_False.out.exp | 1 + .../test_hash/_sha512_--base32_True.out.exp | 1 + .../test_hash/_sha512_--sri_False.out.exp | 1 + .../test_hash/_sha512_--sri_True.out.exp | 1 + .../test_hash/a_md5_--base16_False.out.exp | 1 + .../test_hash/a_md5_--base16_True.out.exp | 1 + .../test_hash/a_md5_--base32_False.out.exp | 1 + .../test_hash/a_md5_--base32_True.out.exp | 1 + .../test_hash/a_md5_--sri_False.out.exp | 1 + .../assets/test_hash/a_md5_--sri_True.out.exp | 1 + .../test_hash/a_sha1_--base16_False.out.exp | 1 + .../test_hash/a_sha1_--base16_True.out.exp | 1 + .../test_hash/a_sha1_--base32_False.out.exp | 1 + .../test_hash/a_sha1_--base32_True.out.exp | 1 + .../test_hash/a_sha1_--sri_False.out.exp | 1 + .../test_hash/a_sha1_--sri_True.out.exp | 1 + .../test_hash/a_sha256_--base16_False.out.exp | 1 + .../test_hash/a_sha256_--base16_True.out.exp | 1 + .../test_hash/a_sha256_--base32_False.out.exp | 1 + .../test_hash/a_sha256_--base32_True.out.exp | 1 + .../test_hash/a_sha256_--sri_False.out.exp | 1 + .../test_hash/a_sha256_--sri_True.out.exp | 1 + .../test_hash/a_sha512_--base16_False.out.exp | 1 + .../test_hash/a_sha512_--base16_True.out.exp | 1 + .../test_hash/a_sha512_--base32_False.out.exp | 1 + .../test_hash/a_sha512_--base32_True.out.exp | 1 + .../test_hash/a_sha512_--sri_False.out.exp | 1 + .../test_hash/a_sha512_--sri_True.out.exp | 1 + .../test_hash/abc_md5_--base16_False.out.exp | 1 + .../test_hash/abc_md5_--base16_True.out.exp | 1 + .../test_hash/abc_md5_--base32_False.out.exp | 1 + .../test_hash/abc_md5_--base32_True.out.exp | 1 + .../test_hash/abc_md5_--sri_False.out.exp | 1 + .../test_hash/abc_md5_--sri_True.out.exp | 1 + .../test_hash/abc_sha1_--base16_False.out.exp | 1 + .../test_hash/abc_sha1_--base16_True.out.exp | 1 + .../test_hash/abc_sha1_--base32_False.out.exp | 1 + .../test_hash/abc_sha1_--base32_True.out.exp | 1 + .../test_hash/abc_sha1_--sri_False.out.exp | 1 + .../test_hash/abc_sha1_--sri_True.out.exp | 1 + .../abc_sha256_--base16_False.out.exp | 1 + .../abc_sha256_--base16_True.out.exp | 1 + .../abc_sha256_--base32_False.out.exp | 1 + .../abc_sha256_--base32_True.out.exp | 1 + .../test_hash/abc_sha256_--sri_False.out.exp | 1 + .../test_hash/abc_sha256_--sri_True.out.exp | 1 + .../abc_sha512_--base16_False.out.exp | 1 + .../abc_sha512_--base16_True.out.exp | 1 + .../abc_sha512_--base32_False.out.exp | 1 + .../abc_sha512_--base32_True.out.exp | 1 + .../test_hash/abc_sha512_--sri_False.out.exp | 1 + .../test_hash/abc_sha512_--sri_True.out.exp | 1 + ...lmnlmnomnopnopq_md5_--base16_False.out.exp | 1 + ...klmnlmnomnopnopq_md5_--base16_True.out.exp | 1 + ...lmnlmnomnopnopq_md5_--base32_False.out.exp | 1 + ...klmnlmnomnopnopq_md5_--base32_True.out.exp | 1 + ...lmklmnlmnomnopnopq_md5_--sri_False.out.exp | 1 + ...klmklmnlmnomnopnopq_md5_--sri_True.out.exp | 1 + ...mnlmnomnopnopq_sha1_--base16_False.out.exp | 1 + ...lmnlmnomnopnopq_sha1_--base16_True.out.exp | 1 + ...mnlmnomnopnopq_sha1_--base32_False.out.exp | 1 + ...lmnlmnomnopnopq_sha1_--base32_True.out.exp | 1 + ...mklmnlmnomnopnopq_sha1_--sri_False.out.exp | 1 + ...lmklmnlmnomnopnopq_sha1_--sri_True.out.exp | 1 + ...lmnomnopnopq_sha256_--base16_False.out.exp | 1 + ...nlmnomnopnopq_sha256_--base16_True.out.exp | 1 + ...lmnomnopnopq_sha256_--base32_False.out.exp | 1 + ...nlmnomnopnopq_sha256_--base32_True.out.exp | 1 + ...lmnlmnomnopnopq_sha256_--sri_False.out.exp | 1 + ...klmnlmnomnopnopq_sha256_--sri_True.out.exp | 1 + ...lmnomnopnopq_sha512_--base16_False.out.exp | 1 + ...nlmnomnopnopq_sha512_--base16_True.out.exp | 1 + ...lmnomnopnopq_sha512_--base32_False.out.exp | 1 + ...nlmnomnopnopq_sha512_--base32_True.out.exp | 1 + ...lmnlmnomnopnopq_sha512_--sri_False.out.exp | 1 + ...klmnlmnomnopnopq_sha512_--sri_True.out.exp | 1 + .../message_digest_md5_--base16_False.out.exp | 1 + .../message_digest_md5_--base16_True.out.exp | 1 + .../message_digest_md5_--base32_False.out.exp | 1 + .../message_digest_md5_--base32_True.out.exp | 1 + .../message_digest_md5_--sri_False.out.exp | 1 + .../message_digest_md5_--sri_True.out.exp | 1 + ...message_digest_sha1_--base16_False.out.exp | 1 + .../message_digest_sha1_--base16_True.out.exp | 1 + ...message_digest_sha1_--base32_False.out.exp | 1 + .../message_digest_sha1_--base32_True.out.exp | 1 + .../message_digest_sha1_--sri_False.out.exp | 1 + .../message_digest_sha1_--sri_True.out.exp | 1 + ...ssage_digest_sha256_--base16_False.out.exp | 1 + ...essage_digest_sha256_--base16_True.out.exp | 1 + ...ssage_digest_sha256_--base32_False.out.exp | 1 + ...essage_digest_sha256_--base32_True.out.exp | 1 + .../message_digest_sha256_--sri_False.out.exp | 1 + .../message_digest_sha256_--sri_True.out.exp | 1 + ...ssage_digest_sha512_--base16_False.out.exp | 1 + ...essage_digest_sha512_--base16_True.out.exp | 1 + ...ssage_digest_sha512_--base32_False.out.exp | 1 + ...essage_digest_sha512_--base32_True.out.exp | 1 + .../message_digest_sha512_--sri_False.out.exp | 1 + .../message_digest_sha512_--sri_True.out.exp | 1 + tests/functional2/commands/test_hash.py | 136 ++++++++++++++++++ .../testlib/fixtures/file_helper.py | 10 +- 124 files changed, 261 insertions(+), 113 deletions(-) delete mode 100644 tests/functional/hash.sh create mode 100644 tests/functional2/commands/assets/test_hash/_md5_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_md5_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_md5_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_md5_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_md5_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_md5_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha1_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha1_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha1_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha1_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha1_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha1_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha256_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha256_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha256_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha256_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha256_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha256_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha512_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha512_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha512_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha512_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha512_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/_sha512_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_md5_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_md5_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_md5_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_md5_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_md5_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_md5_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha1_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha1_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha1_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha1_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha1_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha1_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha256_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha256_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha256_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha256_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha256_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha256_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha512_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha512_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha512_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha512_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha512_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/a_sha512_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_md5_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_md5_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_md5_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_md5_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_md5_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_md5_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha1_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha1_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha1_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha1_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha1_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha1_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha256_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha256_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha256_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha256_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha256_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha256_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha512_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha512_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha512_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha512_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha512_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abc_sha512_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_md5_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_md5_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_md5_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_md5_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_md5_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_md5_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha1_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha1_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha1_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha1_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha1_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha1_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha256_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha256_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha256_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha256_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha256_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha256_--sri_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha512_--base16_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha512_--base16_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha512_--base32_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha512_--base32_True.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha512_--sri_False.out.exp create mode 100644 tests/functional2/commands/assets/test_hash/message_digest_sha512_--sri_True.out.exp create mode 100644 tests/functional2/commands/test_hash.py diff --git a/tests/functional/hash.sh b/tests/functional/hash.sh deleted file mode 100644 index 34c1bb38a..000000000 --- a/tests/functional/hash.sh +++ /dev/null @@ -1,107 +0,0 @@ -source common.sh - -try () { - printf "%s" "$2" > $TEST_ROOT/vector - hash="$(nix-hash --flat ${FORMAT_FLAG-} --type "$1" "$TEST_ROOT/vector")" - if ! (( "${NO_TEST_CLASSIC-}" )) && test "$hash" != "$3"; then - echo "try nix-hash: hash $1, expected $3, got $hash" - exit 1 - fi - hash="$(nix hash file ${FORMAT_FLAG-} --type "$1" "$TEST_ROOT/vector")" - if ! (( "${NO_TEST_NIX_COMMAND-}" )) && test "$hash" != "$3"; then - echo "try nix hash: hash $1, expected $3, got $hash" - exit 1 - fi -} - -FORMAT_FLAG=--base16 -try md5 "" "d41d8cd98f00b204e9800998ecf8427e" -try md5 "a" "0cc175b9c0f1b6a831c399e269772661" -try md5 "abc" "900150983cd24fb0d6963f7d28e17f72" -try md5 "message digest" "f96b697d7cb7938d525a2f31aaf161d0" -try md5 "abcdefghijklmnopqrstuvwxyz" "c3fcd3d76192e4007dfb496cca67e13b" -try md5 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" "d174ab98d277d9f5a5611c2c9f419d9f" -try md5 "12345678901234567890123456789012345678901234567890123456789012345678901234567890" "57edf4a22be3c955ac49da2e2107b67a" - -try sha1 "" "da39a3ee5e6b4b0d3255bfef95601890afd80709" -try sha1 "abc" "a9993e364706816aba3e25717850c26c9cd0d89d" -try sha1 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" "84983e441c3bd26ebaae4aa1f95129e5e54670f1" - -try sha256 "" "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" -try sha256 "abc" "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" -try sha256 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1" - -try sha512 "" "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e" -try sha512 "abc" "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f" -try sha512 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" "204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445" -unset FORMAT_FLAG - -FORMAT_FLAG=--base32 -try sha256 "abc" "1b8m03r63zqhnjf7l5wnldhh7c134ap5vpj0850ymkq1iyzicy5s" -unset FORMAT_FLAG - -FORMAT_FLAG=--sri -try sha512 "" "sha512-z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==" -try sha512 "abc" "sha512-3a81oZNherrMQXNJriBBMRLm+k6JqX6iCp7u5ktV05ohkpkqJ0/BqDa6PCOj/uu9RU1EI2Q86A4qmslPpUyknw==" -try sha512 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" "sha512-IEqPxt2oLwoM7XvrjgikFlfBbvRosiioJ5vjMacDwzWW/RXBOxsH+aodO+pXeJygMa2Fx6cd1wNU7GMSOMo0RQ==" -try sha256 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" "sha256-JI1qYdIGOLjlwCaTDD5gOaM85Flk/yFn9uzt1BnbBsE=" -unset FORMAT_FLAG - -# nix-hash [--flat] defaults to the Base16 format -NO_TEST_NIX_COMMAND=1 try sha512 "abc" "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f" - -# nix hash [file|path] defaults to the SRI format -NO_TEST_CLASSIC=1 try sha512 "abc" "sha512-3a81oZNherrMQXNJriBBMRLm+k6JqX6iCp7u5ktV05ohkpkqJ0/BqDa6PCOj/uu9RU1EI2Q86A4qmslPpUyknw==" - -try2 () { - hash=$(nix-hash --type "$1" $TEST_ROOT/hash-path) - if test "$hash" != "$2"; then - echo "hash $1, expected $2, got $hash" - exit 1 - fi -} - -rm -rf $TEST_ROOT/hash-path -mkdir $TEST_ROOT/hash-path -echo "Hello World" > $TEST_ROOT/hash-path/hello - -try2 md5 "ea9b55537dd4c7e104515b2ccfaf4100" - -# Execute bit matters. -chmod +x $TEST_ROOT/hash-path/hello -try2 md5 "20f3ffe011d4cfa7d72bfabef7882836" - -# Mtime and other bits don't. -touch -r . $TEST_ROOT/hash-path/hello -chmod 744 $TEST_ROOT/hash-path/hello -try2 md5 "20f3ffe011d4cfa7d72bfabef7882836" - -# File type (e.g., symlink) does. -rm $TEST_ROOT/hash-path/hello -ln -s x $TEST_ROOT/hash-path/hello -try2 md5 "f78b733a68f5edbdf9413899339eaa4a" - -# Conversion. -try3() { - h64=$(nix-hash --type "$1" --to-base64 "$2") - [ "$h64" = "$4" ] - h64=$(nix hash to-base64 --type "$1" "$2") - [ "$h64" = "$4" ] - sri=$(nix-hash --type "$1" --to-sri "$2") - [ "$sri" = "$1-$4" ] - sri=$(nix hash to-sri --type "$1" "$2") - [ "$sri" = "$1-$4" ] - h32=$(nix-hash --type "$1" --to-base32 "$2") - [ "$h32" = "$3" ] - h32=$(nix hash to-base32 --type "$1" "$2") - [ "$h32" = "$3" ] - h16=$(nix-hash --type "$1" --to-base16 "$h32") - [ "$h16" = "$2" ] - h16=$(nix hash to-base16 --type "$1" "$h64") - [ "$h16" = "$2" ] - h16=$(nix hash to-base16 "$sri") - [ "$h16" = "$2" ] -} -try3 sha1 "800d59cfcd3c05e900cb4e214be48f6b886a08df" "vw46m23bizj4n8afrc0fj19wrp7mj3c0" "gA1Zz808BekAy04hS+SPa4hqCN8=" -try3 sha256 "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" "1b8m03r63zqhnjf7l5wnldhh7c134ap5vpj0850ymkq1iyzicy5s" "ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0=" -try3 sha512 "204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445" "12k9jiq29iyqm03swfsgiw5mlqs173qazm3n7daz43infy12pyrcdf30fkk3qwv4yl2ick8yipc2mqnlh48xsvvxl60lbx8vp38yji0" "IEqPxt2oLwoM7XvrjgikFlfBbvRosiioJ5vjMacDwzWW/RXBOxsH+aodO+pXeJygMa2Fx6cd1wNU7GMSOMo0RQ==" diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 7b73ed26a..c0262769e 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -87,7 +87,6 @@ functional_tests_scripts = [ 'optimise-store.sh', 'substitute-with-invalid-ca.sh', 'signing.sh', - 'hash.sh', 'gc-non-blocking.sh', 'check.sh', 'nix-shell/basic.sh', diff --git a/tests/functional2/commands/assets/test_hash/_md5_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/_md5_--base16_False.out.exp new file mode 100644 index 000000000..df9edc403 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_md5_--base16_False.out.exp @@ -0,0 +1 @@ +d41d8cd98f00b204e9800998ecf8427e diff --git a/tests/functional2/commands/assets/test_hash/_md5_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/_md5_--base16_True.out.exp new file mode 100644 index 000000000..df9edc403 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_md5_--base16_True.out.exp @@ -0,0 +1 @@ +d41d8cd98f00b204e9800998ecf8427e diff --git a/tests/functional2/commands/assets/test_hash/_md5_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/_md5_--base32_False.out.exp new file mode 100644 index 000000000..8601a5b21 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_md5_--base32_False.out.exp @@ -0,0 +1 @@ +3y8bwfr609h3lh9ch0izcqq7fl diff --git a/tests/functional2/commands/assets/test_hash/_md5_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/_md5_--base32_True.out.exp new file mode 100644 index 000000000..8601a5b21 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_md5_--base32_True.out.exp @@ -0,0 +1 @@ +3y8bwfr609h3lh9ch0izcqq7fl diff --git a/tests/functional2/commands/assets/test_hash/_md5_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/_md5_--sri_False.out.exp new file mode 100644 index 000000000..f328e5d10 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_md5_--sri_False.out.exp @@ -0,0 +1 @@ +md5-1B2M2Y8AsgTpgAmY7PhCfg== diff --git a/tests/functional2/commands/assets/test_hash/_md5_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/_md5_--sri_True.out.exp new file mode 100644 index 000000000..f328e5d10 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_md5_--sri_True.out.exp @@ -0,0 +1 @@ +md5-1B2M2Y8AsgTpgAmY7PhCfg== diff --git a/tests/functional2/commands/assets/test_hash/_sha1_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/_sha1_--base16_False.out.exp new file mode 100644 index 000000000..be0e2cdbd --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha1_--base16_False.out.exp @@ -0,0 +1 @@ +da39a3ee5e6b4b0d3255bfef95601890afd80709 diff --git a/tests/functional2/commands/assets/test_hash/_sha1_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/_sha1_--base16_True.out.exp new file mode 100644 index 000000000..be0e2cdbd --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha1_--base16_True.out.exp @@ -0,0 +1 @@ +da39a3ee5e6b4b0d3255bfef95601890afd80709 diff --git a/tests/functional2/commands/assets/test_hash/_sha1_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/_sha1_--base32_False.out.exp new file mode 100644 index 000000000..40bfdb8e5 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha1_--base32_False.out.exp @@ -0,0 +1 @@ +143xibwh31h9bvxzalr0sjvbbvpa6ffs diff --git a/tests/functional2/commands/assets/test_hash/_sha1_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/_sha1_--base32_True.out.exp new file mode 100644 index 000000000..40bfdb8e5 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha1_--base32_True.out.exp @@ -0,0 +1 @@ +143xibwh31h9bvxzalr0sjvbbvpa6ffs diff --git a/tests/functional2/commands/assets/test_hash/_sha1_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/_sha1_--sri_False.out.exp new file mode 100644 index 000000000..9defa5efa --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha1_--sri_False.out.exp @@ -0,0 +1 @@ +sha1-2jmj7l5rSw0yVb/vlWAYkK/YBwk= diff --git a/tests/functional2/commands/assets/test_hash/_sha1_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/_sha1_--sri_True.out.exp new file mode 100644 index 000000000..9defa5efa --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha1_--sri_True.out.exp @@ -0,0 +1 @@ +sha1-2jmj7l5rSw0yVb/vlWAYkK/YBwk= diff --git a/tests/functional2/commands/assets/test_hash/_sha256_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/_sha256_--base16_False.out.exp new file mode 100644 index 000000000..c30680402 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha256_--base16_False.out.exp @@ -0,0 +1 @@ +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 diff --git a/tests/functional2/commands/assets/test_hash/_sha256_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/_sha256_--base16_True.out.exp new file mode 100644 index 000000000..c30680402 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha256_--base16_True.out.exp @@ -0,0 +1 @@ +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 diff --git a/tests/functional2/commands/assets/test_hash/_sha256_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/_sha256_--base32_False.out.exp new file mode 100644 index 000000000..6977499e5 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha256_--base32_False.out.exp @@ -0,0 +1 @@ +0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73 diff --git a/tests/functional2/commands/assets/test_hash/_sha256_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/_sha256_--base32_True.out.exp new file mode 100644 index 000000000..6977499e5 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha256_--base32_True.out.exp @@ -0,0 +1 @@ +0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73 diff --git a/tests/functional2/commands/assets/test_hash/_sha256_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/_sha256_--sri_False.out.exp new file mode 100644 index 000000000..feb542177 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha256_--sri_False.out.exp @@ -0,0 +1 @@ +sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= diff --git a/tests/functional2/commands/assets/test_hash/_sha256_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/_sha256_--sri_True.out.exp new file mode 100644 index 000000000..feb542177 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha256_--sri_True.out.exp @@ -0,0 +1 @@ +sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= diff --git a/tests/functional2/commands/assets/test_hash/_sha512_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/_sha512_--base16_False.out.exp new file mode 100644 index 000000000..c2f1924ca --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha512_--base16_False.out.exp @@ -0,0 +1 @@ +cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e diff --git a/tests/functional2/commands/assets/test_hash/_sha512_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/_sha512_--base16_True.out.exp new file mode 100644 index 000000000..c2f1924ca --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha512_--base16_True.out.exp @@ -0,0 +1 @@ +cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e diff --git a/tests/functional2/commands/assets/test_hash/_sha512_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/_sha512_--base32_False.out.exp new file mode 100644 index 000000000..3cca733ca --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha512_--base32_False.out.exp @@ -0,0 +1 @@ +0zdl9zrg8r3i9c1g90lgg9ip5ijzv3yhz91i0zzn3r8ap9ws784gkp9dk9j3aglhgf1amqb0pj21mh7h1nxcl18akqvvf7ggqsy30yg diff --git a/tests/functional2/commands/assets/test_hash/_sha512_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/_sha512_--base32_True.out.exp new file mode 100644 index 000000000..3cca733ca --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha512_--base32_True.out.exp @@ -0,0 +1 @@ +0zdl9zrg8r3i9c1g90lgg9ip5ijzv3yhz91i0zzn3r8ap9ws784gkp9dk9j3aglhgf1amqb0pj21mh7h1nxcl18akqvvf7ggqsy30yg diff --git a/tests/functional2/commands/assets/test_hash/_sha512_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/_sha512_--sri_False.out.exp new file mode 100644 index 000000000..2946ecc48 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha512_--sri_False.out.exp @@ -0,0 +1 @@ +sha512-z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg== diff --git a/tests/functional2/commands/assets/test_hash/_sha512_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/_sha512_--sri_True.out.exp new file mode 100644 index 000000000..2946ecc48 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/_sha512_--sri_True.out.exp @@ -0,0 +1 @@ +sha512-z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg== diff --git a/tests/functional2/commands/assets/test_hash/a_md5_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/a_md5_--base16_False.out.exp new file mode 100644 index 000000000..0b090d840 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_md5_--base16_False.out.exp @@ -0,0 +1 @@ +0cc175b9c0f1b6a831c399e269772661 diff --git a/tests/functional2/commands/assets/test_hash/a_md5_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/a_md5_--base16_True.out.exp new file mode 100644 index 000000000..0b090d840 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_md5_--base16_True.out.exp @@ -0,0 +1 @@ +0cc175b9c0f1b6a831c399e269772661 diff --git a/tests/functional2/commands/assets/test_hash/a_md5_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/a_md5_--base32_False.out.exp new file mode 100644 index 000000000..a4aed29a0 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_md5_--base32_False.out.exp @@ -0,0 +1 @@ +314rvnkqlrqcqsidpiq2wpbh8c diff --git a/tests/functional2/commands/assets/test_hash/a_md5_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/a_md5_--base32_True.out.exp new file mode 100644 index 000000000..a4aed29a0 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_md5_--base32_True.out.exp @@ -0,0 +1 @@ +314rvnkqlrqcqsidpiq2wpbh8c diff --git a/tests/functional2/commands/assets/test_hash/a_md5_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/a_md5_--sri_False.out.exp new file mode 100644 index 000000000..c1d191303 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_md5_--sri_False.out.exp @@ -0,0 +1 @@ +md5-DMF1ucDxtqgxw5niaXcmYQ== diff --git a/tests/functional2/commands/assets/test_hash/a_md5_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/a_md5_--sri_True.out.exp new file mode 100644 index 000000000..c1d191303 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_md5_--sri_True.out.exp @@ -0,0 +1 @@ +md5-DMF1ucDxtqgxw5niaXcmYQ== diff --git a/tests/functional2/commands/assets/test_hash/a_sha1_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/a_sha1_--base16_False.out.exp new file mode 100644 index 000000000..bac077424 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha1_--base16_False.out.exp @@ -0,0 +1 @@ +86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 diff --git a/tests/functional2/commands/assets/test_hash/a_sha1_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/a_sha1_--base16_True.out.exp new file mode 100644 index 000000000..bac077424 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha1_--base16_True.out.exp @@ -0,0 +1 @@ +86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 diff --git a/tests/functional2/commands/assets/test_hash/a_sha1_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/a_sha1_--base32_False.out.exp new file mode 100644 index 000000000..7aabe674c --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha1_--base32_False.out.exp @@ -0,0 +1 @@ +p1kpcdzaxbmbkp0xbphzr9x5z8vy9xw6 diff --git a/tests/functional2/commands/assets/test_hash/a_sha1_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/a_sha1_--base32_True.out.exp new file mode 100644 index 000000000..7aabe674c --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha1_--base32_True.out.exp @@ -0,0 +1 @@ +p1kpcdzaxbmbkp0xbphzr9x5z8vy9xw6 diff --git a/tests/functional2/commands/assets/test_hash/a_sha1_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/a_sha1_--sri_False.out.exp new file mode 100644 index 000000000..ed7c1436a --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha1_--sri_False.out.exp @@ -0,0 +1 @@ +sha1-hvfkN/qlp/zhXR3cuerq6jd2Z7g= diff --git a/tests/functional2/commands/assets/test_hash/a_sha1_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/a_sha1_--sri_True.out.exp new file mode 100644 index 000000000..ed7c1436a --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha1_--sri_True.out.exp @@ -0,0 +1 @@ +sha1-hvfkN/qlp/zhXR3cuerq6jd2Z7g= diff --git a/tests/functional2/commands/assets/test_hash/a_sha256_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/a_sha256_--base16_False.out.exp new file mode 100644 index 000000000..37d7d3c02 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha256_--base16_False.out.exp @@ -0,0 +1 @@ +ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb diff --git a/tests/functional2/commands/assets/test_hash/a_sha256_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/a_sha256_--base16_True.out.exp new file mode 100644 index 000000000..37d7d3c02 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha256_--base16_True.out.exp @@ -0,0 +1 @@ +ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb diff --git a/tests/functional2/commands/assets/test_hash/a_sha256_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/a_sha256_--base32_False.out.exp new file mode 100644 index 000000000..c057564fd --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha256_--base32_False.out.exp @@ -0,0 +1 @@ +1fs8xspqaxw0p5r4wz0lz3pqd9sdvhirmcriqbxcmg8vr89835ya diff --git a/tests/functional2/commands/assets/test_hash/a_sha256_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/a_sha256_--base32_True.out.exp new file mode 100644 index 000000000..c057564fd --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha256_--base32_True.out.exp @@ -0,0 +1 @@ +1fs8xspqaxw0p5r4wz0lz3pqd9sdvhirmcriqbxcmg8vr89835ya diff --git a/tests/functional2/commands/assets/test_hash/a_sha256_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/a_sha256_--sri_False.out.exp new file mode 100644 index 000000000..7049718a3 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha256_--sri_False.out.exp @@ -0,0 +1 @@ +sha256-ypeBEsobvcr6wjGzmiPcTaeG7/gUfE5yuYB3ha/uSLs= diff --git a/tests/functional2/commands/assets/test_hash/a_sha256_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/a_sha256_--sri_True.out.exp new file mode 100644 index 000000000..7049718a3 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha256_--sri_True.out.exp @@ -0,0 +1 @@ +sha256-ypeBEsobvcr6wjGzmiPcTaeG7/gUfE5yuYB3ha/uSLs= diff --git a/tests/functional2/commands/assets/test_hash/a_sha512_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/a_sha512_--base16_False.out.exp new file mode 100644 index 000000000..0887c8e17 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha512_--base16_False.out.exp @@ -0,0 +1 @@ +1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 diff --git a/tests/functional2/commands/assets/test_hash/a_sha512_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/a_sha512_--base16_True.out.exp new file mode 100644 index 000000000..0887c8e17 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha512_--base16_True.out.exp @@ -0,0 +1 @@ +1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 diff --git a/tests/functional2/commands/assets/test_hash/a_sha512_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/a_sha512_--base32_False.out.exp new file mode 100644 index 000000000..c2c53d99c --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha512_--base32_False.out.exp @@ -0,0 +1 @@ +1srmzjj4rxrbiyg2a6cxfzvd7rlc191figallh2as6z0av51j304lqg1rbd0m5wbbh5scqqiv9dgmgjhbsnrvkr15sr85i4va9gqh0z diff --git a/tests/functional2/commands/assets/test_hash/a_sha512_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/a_sha512_--base32_True.out.exp new file mode 100644 index 000000000..c2c53d99c --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha512_--base32_True.out.exp @@ -0,0 +1 @@ +1srmzjj4rxrbiyg2a6cxfzvd7rlc191figallh2as6z0av51j304lqg1rbd0m5wbbh5scqqiv9dgmgjhbsnrvkr15sr85i4va9gqh0z diff --git a/tests/functional2/commands/assets/test_hash/a_sha512_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/a_sha512_--sri_False.out.exp new file mode 100644 index 000000000..c21683e34 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha512_--sri_False.out.exp @@ -0,0 +1 @@ +sha512-H0D8ktokFpR1CXnubPWC8tXX0o4YM13gWrxU0FYOD1MChgxlK/CNVgJSql50IQVG82n7u86MEs/HlXsmUv6adQ== diff --git a/tests/functional2/commands/assets/test_hash/a_sha512_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/a_sha512_--sri_True.out.exp new file mode 100644 index 000000000..c21683e34 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/a_sha512_--sri_True.out.exp @@ -0,0 +1 @@ +sha512-H0D8ktokFpR1CXnubPWC8tXX0o4YM13gWrxU0FYOD1MChgxlK/CNVgJSql50IQVG82n7u86MEs/HlXsmUv6adQ== diff --git a/tests/functional2/commands/assets/test_hash/abc_md5_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/abc_md5_--base16_False.out.exp new file mode 100644 index 000000000..f5e5e5d04 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_md5_--base16_False.out.exp @@ -0,0 +1 @@ +900150983cd24fb0d6963f7d28e17f72 diff --git a/tests/functional2/commands/assets/test_hash/abc_md5_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/abc_md5_--base16_True.out.exp new file mode 100644 index 000000000..f5e5e5d04 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_md5_--base16_True.out.exp @@ -0,0 +1 @@ +900150983cd24fb0d6963f7d28e17f72 diff --git a/tests/functional2/commands/assets/test_hash/abc_md5_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/abc_md5_--base32_False.out.exp new file mode 100644 index 000000000..2a69bc0e1 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_md5_--base32_False.out.exp @@ -0,0 +1 @@ +3jgzhjhz9zjvbb0kyj7jc500ch diff --git a/tests/functional2/commands/assets/test_hash/abc_md5_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/abc_md5_--base32_True.out.exp new file mode 100644 index 000000000..2a69bc0e1 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_md5_--base32_True.out.exp @@ -0,0 +1 @@ +3jgzhjhz9zjvbb0kyj7jc500ch diff --git a/tests/functional2/commands/assets/test_hash/abc_md5_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/abc_md5_--sri_False.out.exp new file mode 100644 index 000000000..2bcd6b922 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_md5_--sri_False.out.exp @@ -0,0 +1 @@ +md5-kAFQmDzST7DWlj99KOF/cg== diff --git a/tests/functional2/commands/assets/test_hash/abc_md5_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/abc_md5_--sri_True.out.exp new file mode 100644 index 000000000..2bcd6b922 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_md5_--sri_True.out.exp @@ -0,0 +1 @@ +md5-kAFQmDzST7DWlj99KOF/cg== diff --git a/tests/functional2/commands/assets/test_hash/abc_sha1_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha1_--base16_False.out.exp new file mode 100644 index 000000000..215b48efa --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha1_--base16_False.out.exp @@ -0,0 +1 @@ +a9993e364706816aba3e25717850c26c9cd0d89d diff --git a/tests/functional2/commands/assets/test_hash/abc_sha1_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha1_--base16_True.out.exp new file mode 100644 index 000000000..215b48efa --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha1_--base16_True.out.exp @@ -0,0 +1 @@ +a9993e364706816aba3e25717850c26c9cd0d89d diff --git a/tests/functional2/commands/assets/test_hash/abc_sha1_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha1_--base32_False.out.exp new file mode 100644 index 000000000..451c13022 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha1_--base32_False.out.exp @@ -0,0 +1 @@ +kpcd173cq987hw957sx6m0868wv3x6d9 diff --git a/tests/functional2/commands/assets/test_hash/abc_sha1_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha1_--base32_True.out.exp new file mode 100644 index 000000000..451c13022 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha1_--base32_True.out.exp @@ -0,0 +1 @@ +kpcd173cq987hw957sx6m0868wv3x6d9 diff --git a/tests/functional2/commands/assets/test_hash/abc_sha1_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha1_--sri_False.out.exp new file mode 100644 index 000000000..afd3a3f0e --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha1_--sri_False.out.exp @@ -0,0 +1 @@ +sha1-qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/tests/functional2/commands/assets/test_hash/abc_sha1_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha1_--sri_True.out.exp new file mode 100644 index 000000000..afd3a3f0e --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha1_--sri_True.out.exp @@ -0,0 +1 @@ +sha1-qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/tests/functional2/commands/assets/test_hash/abc_sha256_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha256_--base16_False.out.exp new file mode 100644 index 000000000..b760ccc42 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha256_--base16_False.out.exp @@ -0,0 +1 @@ +ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad diff --git a/tests/functional2/commands/assets/test_hash/abc_sha256_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha256_--base16_True.out.exp new file mode 100644 index 000000000..b760ccc42 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha256_--base16_True.out.exp @@ -0,0 +1 @@ +ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad diff --git a/tests/functional2/commands/assets/test_hash/abc_sha256_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha256_--base32_False.out.exp new file mode 100644 index 000000000..60a1d220e --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha256_--base32_False.out.exp @@ -0,0 +1 @@ +1b8m03r63zqhnjf7l5wnldhh7c134ap5vpj0850ymkq1iyzicy5s diff --git a/tests/functional2/commands/assets/test_hash/abc_sha256_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha256_--base32_True.out.exp new file mode 100644 index 000000000..60a1d220e --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha256_--base32_True.out.exp @@ -0,0 +1 @@ +1b8m03r63zqhnjf7l5wnldhh7c134ap5vpj0850ymkq1iyzicy5s diff --git a/tests/functional2/commands/assets/test_hash/abc_sha256_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha256_--sri_False.out.exp new file mode 100644 index 000000000..b0df8ce52 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha256_--sri_False.out.exp @@ -0,0 +1 @@ +sha256-ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0= diff --git a/tests/functional2/commands/assets/test_hash/abc_sha256_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha256_--sri_True.out.exp new file mode 100644 index 000000000..b0df8ce52 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha256_--sri_True.out.exp @@ -0,0 +1 @@ +sha256-ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0= diff --git a/tests/functional2/commands/assets/test_hash/abc_sha512_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha512_--base16_False.out.exp new file mode 100644 index 000000000..fcf69b238 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha512_--base16_False.out.exp @@ -0,0 +1 @@ +ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f diff --git a/tests/functional2/commands/assets/test_hash/abc_sha512_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha512_--base16_True.out.exp new file mode 100644 index 000000000..fcf69b238 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha512_--base16_True.out.exp @@ -0,0 +1 @@ +ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f diff --git a/tests/functional2/commands/assets/test_hash/abc_sha512_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha512_--base32_False.out.exp new file mode 100644 index 000000000..acfbaa2d6 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha512_--base32_False.out.exp @@ -0,0 +1 @@ +2gs8k559z4rlahfx0y688s49m2vvszylcikrfinm30ly9rak69236nkam5ydvly1ai7xac99vxfc4ii84hawjbk876blyk1jfhkbbyx diff --git a/tests/functional2/commands/assets/test_hash/abc_sha512_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha512_--base32_True.out.exp new file mode 100644 index 000000000..acfbaa2d6 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha512_--base32_True.out.exp @@ -0,0 +1 @@ +2gs8k559z4rlahfx0y688s49m2vvszylcikrfinm30ly9rak69236nkam5ydvly1ai7xac99vxfc4ii84hawjbk876blyk1jfhkbbyx diff --git a/tests/functional2/commands/assets/test_hash/abc_sha512_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha512_--sri_False.out.exp new file mode 100644 index 000000000..464305181 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha512_--sri_False.out.exp @@ -0,0 +1 @@ +sha512-3a81oZNherrMQXNJriBBMRLm+k6JqX6iCp7u5ktV05ohkpkqJ0/BqDa6PCOj/uu9RU1EI2Q86A4qmslPpUyknw== diff --git a/tests/functional2/commands/assets/test_hash/abc_sha512_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/abc_sha512_--sri_True.out.exp new file mode 100644 index 000000000..464305181 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abc_sha512_--sri_True.out.exp @@ -0,0 +1 @@ +sha512-3a81oZNherrMQXNJriBBMRLm+k6JqX6iCp7u5ktV05ohkpkqJ0/BqDa6PCOj/uu9RU1EI2Q86A4qmslPpUyknw== diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base16_False.out.exp new file mode 100644 index 000000000..473ad4a23 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base16_False.out.exp @@ -0,0 +1 @@ +8215ef0796a20bcaaae116d3876c664a diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base16_True.out.exp new file mode 100644 index 000000000..473ad4a23 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base16_True.out.exp @@ -0,0 +1 @@ +8215ef0796a20bcaaae116d3876c664a diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base32_False.out.exp new file mode 100644 index 000000000..d13f11714 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base32_False.out.exp @@ -0,0 +1 @@ +2acrn8glqnw6mcl2x2jq3yy5c2 diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base32_True.out.exp new file mode 100644 index 000000000..d13f11714 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--base32_True.out.exp @@ -0,0 +1 @@ +2acrn8glqnw6mcl2x2jq3yy5c2 diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--sri_False.out.exp new file mode 100644 index 000000000..2a7d00f19 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--sri_False.out.exp @@ -0,0 +1 @@ +md5-ghXvB5aiC8qq4RbTh2xmSg== diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--sri_True.out.exp new file mode 100644 index 000000000..2a7d00f19 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_md5_--sri_True.out.exp @@ -0,0 +1 @@ +md5-ghXvB5aiC8qq4RbTh2xmSg== diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base16_False.out.exp new file mode 100644 index 000000000..c585b458d --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base16_False.out.exp @@ -0,0 +1 @@ +84983e441c3bd26ebaae4aa1f95129e5e54670f1 diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base16_True.out.exp new file mode 100644 index 000000000..c585b458d --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base16_True.out.exp @@ -0,0 +1 @@ +84983e441c3bd26ebaae4aa1f95129e5e54670f1 diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base32_False.out.exp new file mode 100644 index 000000000..7b9ba1b98 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base32_False.out.exp @@ -0,0 +1 @@ +y5q4drg5558zk8aamsx6xliv3i23x644 diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base32_True.out.exp new file mode 100644 index 000000000..7b9ba1b98 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--base32_True.out.exp @@ -0,0 +1 @@ +y5q4drg5558zk8aamsx6xliv3i23x644 diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--sri_False.out.exp new file mode 100644 index 000000000..ca4c5d975 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--sri_False.out.exp @@ -0,0 +1 @@ +sha1-hJg+RBw70m66rkqh+VEp5eVGcPE= diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--sri_True.out.exp new file mode 100644 index 000000000..ca4c5d975 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha1_--sri_True.out.exp @@ -0,0 +1 @@ +sha1-hJg+RBw70m66rkqh+VEp5eVGcPE= diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base16_False.out.exp new file mode 100644 index 000000000..17b8625fa --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base16_False.out.exp @@ -0,0 +1 @@ +248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1 diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base16_True.out.exp new file mode 100644 index 000000000..17b8625fa --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base16_True.out.exp @@ -0,0 +1 @@ +248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1 diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base32_False.out.exp new file mode 100644 index 000000000..7ab72e06b --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base32_False.out.exp @@ -0,0 +1 @@ +1h86vccx9vgcyrkj3zv4b7j3r8rrc0z0r4r6q3jvhf06s9hnm394 diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base32_True.out.exp new file mode 100644 index 000000000..7ab72e06b --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--base32_True.out.exp @@ -0,0 +1 @@ +1h86vccx9vgcyrkj3zv4b7j3r8rrc0z0r4r6q3jvhf06s9hnm394 diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--sri_False.out.exp new file mode 100644 index 000000000..b63bb6cbf --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--sri_False.out.exp @@ -0,0 +1 @@ +sha256-JI1qYdIGOLjlwCaTDD5gOaM85Flk/yFn9uzt1BnbBsE= diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--sri_True.out.exp new file mode 100644 index 000000000..b63bb6cbf --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha256_--sri_True.out.exp @@ -0,0 +1 @@ +sha256-JI1qYdIGOLjlwCaTDD5gOaM85Flk/yFn9uzt1BnbBsE= diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base16_False.out.exp new file mode 100644 index 000000000..281a6e734 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base16_False.out.exp @@ -0,0 +1 @@ +204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445 diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base16_True.out.exp new file mode 100644 index 000000000..281a6e734 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base16_True.out.exp @@ -0,0 +1 @@ +204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445 diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base32_False.out.exp new file mode 100644 index 000000000..c750ac0cf --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base32_False.out.exp @@ -0,0 +1 @@ +12k9jiq29iyqm03swfsgiw5mlqs173qazm3n7daz43infy12pyrcdf30fkk3qwv4yl2ick8yipc2mqnlh48xsvvxl60lbx8vp38yji0 diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base32_True.out.exp new file mode 100644 index 000000000..c750ac0cf --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--base32_True.out.exp @@ -0,0 +1 @@ +12k9jiq29iyqm03swfsgiw5mlqs173qazm3n7daz43infy12pyrcdf30fkk3qwv4yl2ick8yipc2mqnlh48xsvvxl60lbx8vp38yji0 diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--sri_False.out.exp new file mode 100644 index 000000000..10b37dad2 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--sri_False.out.exp @@ -0,0 +1 @@ +sha512-IEqPxt2oLwoM7XvrjgikFlfBbvRosiioJ5vjMacDwzWW/RXBOxsH+aodO+pXeJygMa2Fx6cd1wNU7GMSOMo0RQ== diff --git a/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--sri_True.out.exp new file mode 100644 index 000000000..10b37dad2 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq_sha512_--sri_True.out.exp @@ -0,0 +1 @@ +sha512-IEqPxt2oLwoM7XvrjgikFlfBbvRosiioJ5vjMacDwzWW/RXBOxsH+aodO+pXeJygMa2Fx6cd1wNU7GMSOMo0RQ== diff --git a/tests/functional2/commands/assets/test_hash/message_digest_md5_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_md5_--base16_False.out.exp new file mode 100644 index 000000000..ac02b0af9 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_md5_--base16_False.out.exp @@ -0,0 +1 @@ +bae33f0d6044b5ce7dc9f98d9e017845 diff --git a/tests/functional2/commands/assets/test_hash/message_digest_md5_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_md5_--base16_True.out.exp new file mode 100644 index 000000000..ac02b0af9 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_md5_--base16_True.out.exp @@ -0,0 +1 @@ +bae33f0d6044b5ce7dc9f98d9e017845 diff --git a/tests/functional2/commands/assets/test_hash/message_digest_md5_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_md5_--base32_False.out.exp new file mode 100644 index 000000000..6622ecfd7 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_md5_--base32_False.out.exp @@ -0,0 +1 @@ +25g00rx3grr5ywxda4c06kzqxs diff --git a/tests/functional2/commands/assets/test_hash/message_digest_md5_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_md5_--base32_True.out.exp new file mode 100644 index 000000000..6622ecfd7 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_md5_--base32_True.out.exp @@ -0,0 +1 @@ +25g00rx3grr5ywxda4c06kzqxs diff --git a/tests/functional2/commands/assets/test_hash/message_digest_md5_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_md5_--sri_False.out.exp new file mode 100644 index 000000000..0b278f032 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_md5_--sri_False.out.exp @@ -0,0 +1 @@ +md5-uuM/DWBEtc59yfmNngF4RQ== diff --git a/tests/functional2/commands/assets/test_hash/message_digest_md5_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_md5_--sri_True.out.exp new file mode 100644 index 000000000..0b278f032 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_md5_--sri_True.out.exp @@ -0,0 +1 @@ +md5-uuM/DWBEtc59yfmNngF4RQ== diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha1_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha1_--base16_False.out.exp new file mode 100644 index 000000000..d8f3876dc --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha1_--base16_False.out.exp @@ -0,0 +1 @@ +958c5209a169bfffb3f7ae14cc0a9a2404e9b070 diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha1_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha1_--base16_True.out.exp new file mode 100644 index 000000000..d8f3876dc --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha1_--base16_True.out.exp @@ -0,0 +1 @@ +958c5209a169bfffb3f7ae14cc0a9a2404e9b070 diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha1_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha1_--base32_False.out.exp new file mode 100644 index 000000000..2aa073f65 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha1_--base32_False.out.exp @@ -0,0 +1 @@ +f2qfj114k85cq55fyyrzzgv9l44m534m diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha1_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha1_--base32_True.out.exp new file mode 100644 index 000000000..2aa073f65 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha1_--base32_True.out.exp @@ -0,0 +1 @@ +f2qfj114k85cq55fyyrzzgv9l44m534m diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha1_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha1_--sri_False.out.exp new file mode 100644 index 000000000..9a909065e --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha1_--sri_False.out.exp @@ -0,0 +1 @@ +sha1-lYxSCaFpv/+z964UzAqaJATpsHA= diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha1_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha1_--sri_True.out.exp new file mode 100644 index 000000000..9a909065e --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha1_--sri_True.out.exp @@ -0,0 +1 @@ +sha1-lYxSCaFpv/+z964UzAqaJATpsHA= diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha256_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha256_--base16_False.out.exp new file mode 100644 index 000000000..20556f189 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha256_--base16_False.out.exp @@ -0,0 +1 @@ +7e37378a361df1c101a760eb336feeacd22483a899989d194347ce14b1489d98 diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha256_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha256_--base16_True.out.exp new file mode 100644 index 000000000..20556f189 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha256_--base16_True.out.exp @@ -0,0 +1 @@ +7e37378a361df1c101a760eb336feeacd22483a899989d194347ce14b1489d98 diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha256_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha256_--base32_False.out.exp new file mode 100644 index 000000000..faebf3147 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha256_--base32_False.out.exp @@ -0,0 +1 @@ +164x92qi9kj78ccrv64rm21j9lmcxrpk7sv0lw0w3w8x6s53fdvy diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha256_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha256_--base32_True.out.exp new file mode 100644 index 000000000..faebf3147 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha256_--base32_True.out.exp @@ -0,0 +1 @@ +164x92qi9kj78ccrv64rm21j9lmcxrpk7sv0lw0w3w8x6s53fdvy diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha256_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha256_--sri_False.out.exp new file mode 100644 index 000000000..6ae715dea --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha256_--sri_False.out.exp @@ -0,0 +1 @@ +sha256-fjc3ijYd8cEBp2DrM2/urNIkg6iZmJ0ZQ0fOFLFInZg= diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha256_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha256_--sri_True.out.exp new file mode 100644 index 000000000..6ae715dea --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha256_--sri_True.out.exp @@ -0,0 +1 @@ +sha256-fjc3ijYd8cEBp2DrM2/urNIkg6iZmJ0ZQ0fOFLFInZg= diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha512_--base16_False.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha512_--base16_False.out.exp new file mode 100644 index 000000000..2f4207a21 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha512_--base16_False.out.exp @@ -0,0 +1 @@ +50a2c3d9f64a9e90efcf35c2bb1d57ecc18e61de240c1db3b4142cff6422b465fe49c96629612247861ad6fdf9c0ba79372aec2f70d3f624d66dd01f06176022 diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha512_--base16_True.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha512_--base16_True.out.exp new file mode 100644 index 000000000..2f4207a21 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha512_--base16_True.out.exp @@ -0,0 +1 @@ +50a2c3d9f64a9e90efcf35c2bb1d57ecc18e61de240c1db3b4142cff6422b465fe49c96629612247861ad6fdf9c0ba79372aec2f70d3f624d66dd01f06176022 diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha512_--base32_False.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha512_--base32_False.out.exp new file mode 100644 index 000000000..874590319 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha512_--base32_False.out.exp @@ -0,0 +1 @@ +0i605q63z86vmi4yv9p0bzc58vpkfn0z7yxc6l68wi62ab6r54zwrdl49jgyb0lnjris314vrhqxhgcawfvphimrzpr17jayvcw78jh diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha512_--base32_True.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha512_--base32_True.out.exp new file mode 100644 index 000000000..874590319 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha512_--base32_True.out.exp @@ -0,0 +1 @@ +0i605q63z86vmi4yv9p0bzc58vpkfn0z7yxc6l68wi62ab6r54zwrdl49jgyb0lnjris314vrhqxhgcawfvphimrzpr17jayvcw78jh diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha512_--sri_False.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha512_--sri_False.out.exp new file mode 100644 index 000000000..06659e555 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha512_--sri_False.out.exp @@ -0,0 +1 @@ +sha512-UKLD2fZKnpDvzzXCux1X7MGOYd4kDB2ztBQs/2QitGX+SclmKWEiR4Ya1v35wLp5NyrsL3DT9iTWbdAfBhdgIg== diff --git a/tests/functional2/commands/assets/test_hash/message_digest_sha512_--sri_True.out.exp b/tests/functional2/commands/assets/test_hash/message_digest_sha512_--sri_True.out.exp new file mode 100644 index 000000000..06659e555 --- /dev/null +++ b/tests/functional2/commands/assets/test_hash/message_digest_sha512_--sri_True.out.exp @@ -0,0 +1 @@ +sha512-UKLD2fZKnpDvzzXCux1X7MGOYd4kDB2ztBQs/2QitGX+SclmKWEiR4Ya1v35wLp5NyrsL3DT9iTWbdAfBhdgIg== diff --git a/tests/functional2/commands/test_hash.py b/tests/functional2/commands/test_hash.py new file mode 100644 index 000000000..beb8799dc --- /dev/null +++ b/tests/functional2/commands/test_hash.py @@ -0,0 +1,136 @@ +from pathlib import Path +from collections.abc import Callable + +import pytest + +from functional2.testlib.fixtures.file_helper import ( + _init_files, + File, + AssetSymlink, + with_files, + Symlink, +) +from functional2.testlib.fixtures.nix import Nix +from functional2.testlib.fixtures.snapshot import Snapshot + + +@pytest.mark.parametrize("algo", ["md5", "sha1", "sha256", "sha512"]) +@pytest.mark.parametrize( + "content", + ["", "a", "abc", "message_digest", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"], +) +@pytest.mark.parametrize("format_flag", ["--base16", "--base32", "--sri"]) +@pytest.mark.parametrize("classic", [True, False]) +def test_hash( + algo: str, + content: str, + format_flag: str, + classic: bool, + nix: Nix, + snapshot: Callable[[str], Snapshot], + files: Path, +): + _init_files( + { + "vector": File(content), + "expected_hash.txt": AssetSymlink( + f"assets/test_hash/{content}_{algo}_{format_flag}_{classic}.out.exp" + ), + }, + files, + Path(__file__).parent, + ) + + args = [format_flag, "--type", algo, files / "vector"] + if classic: + res = nix.nix(["--flat", *args], nix_exe="nix-hash").run().ok() + else: + res = nix.nix(["hash", "file", *args], flake=True).run().ok() + assert snapshot("expected_hash.txt") == res.stdout_s + + +@with_files({"vector": File("abc")}) +def test_hash_classic_defaults_base16(nix: Nix, files: Path): + res = nix.nix(["--flat", "--type", "sha512", files / "vector"], nix_exe="nix-hash").run().ok() + assert ( + res.stdout_plain + == "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f" + ) + + +@with_files({"vector": File("abc")}) +def test_hash_command_defaults_sri(nix: Nix, files: Path): + res = nix.nix(["hash", "file", "--type", "sha512", files / "vector"], flake=True).run().ok() + assert ( + res.stdout_plain + == "sha512-3a81oZNherrMQXNJriBBMRLm+k6JqX6iCp7u5ktV05ohkpkqJ0/BqDa6PCOj/uu9RU1EI2Q86A4qmslPpUyknw==" + ) + + +@with_files( + { + "hash-part": { + "hello": File("Hello World\n", 0o644) # Default perms + } + } +) +def test_hash_part(nix: Nix, files: Path): + res = nix.nix(["--type", "md5", files / "hash-part"], nix_exe="nix-hash").run().ok() + assert res.stdout_plain == "ea9b55537dd4c7e104515b2ccfaf4100" + + +@with_files( + { + "hash-part": { + "hello": File("Hello World\n", 0o755) # chmod +x + } + } +) +def test_hash_part_exec_matters(nix: Nix, files: Path): + res = nix.nix(["--type", "md5", files / "hash-part"], nix_exe="nix-hash").run().ok() + assert res.stdout_plain == "20f3ffe011d4cfa7d72bfabef7882836" + + +@with_files({"hash-part": {"hello": File("Hello World\n", 0o744)}}) +def test_hash_part_everything_else_doesnt(nix: Nix, files: Path): + res = nix.nix(["--type", "md5", files / "hash-part"], nix_exe="nix-hash").run().ok() + assert res.stdout_plain == "20f3ffe011d4cfa7d72bfabef7882836" + + +@with_files({"hash-part": {"hello": Symlink("x")}}) +def test_hash_part_filetype_matters(nix: Nix, files: Path): + res = nix.nix(["--type", "md5", files / "hash-part"], nix_exe="nix-hash").run().ok() + assert res.stdout_plain == "f78b733a68f5edbdf9413899339eaa4a" + + +@pytest.mark.parametrize( + ("algo", "orig", "b32", "b64"), + [ + ( + "sha1", + "800d59cfcd3c05e900cb4e214be48f6b886a08df", + "vw46m23bizj4n8afrc0fj19wrp7mj3c0", + "gA1Zz808BekAy04hS+SPa4hqCN8=", + ), + ( + "sha256", + "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", + "1b8m03r63zqhnjf7l5wnldhh7c134ap5vpj0850ymkq1iyzicy5s", + "ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0=", + ), + ( + "sha512", + "204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445", + "12k9jiq29iyqm03swfsgiw5mlqs173qazm3n7daz43infy12pyrcdf30fkk3qwv4yl2ick8yipc2mqnlh48xsvvxl60lbx8vp38yji0", + "IEqPxt2oLwoM7XvrjgikFlfBbvRosiioJ5vjMacDwzWW/RXBOxsH+aodO+pXeJygMa2Fx6cd1wNU7GMSOMo0RQ==", + ), + ], +) +def test_hash_conversion(algo: str, orig: str, b32: str, b64: str, nix: Nix): + for target_type, exp in zip( + ["to-base16", "to-base32", "to-base64", "to-sri"], [orig, b32, b64, f"{algo}-{b64}"] + ): + res = nix.nix(["--type", algo, f"--{target_type}", orig], nix_exe="nix-hash").run().ok() + assert res.stdout_plain == exp + res = nix.nix(["hash", target_type, "--type", algo, orig], flake=True).run().ok() + assert res.stdout_plain == exp diff --git a/tests/functional2/testlib/fixtures/file_helper.py b/tests/functional2/testlib/fixtures/file_helper.py index bb931bffa..676455a52 100644 --- a/tests/functional2/testlib/fixtures/file_helper.py +++ b/tests/functional2/testlib/fixtures/file_helper.py @@ -162,19 +162,19 @@ def merge_file_declaration(a: FileDeclaration, b: FileDeclaration) -> FileDeclar return result -def _init_files(files: FileDeclaration, tmp_path: Path, request: pytest.FixtureRequest) -> None: +def _init_files(files: FileDeclaration, current_folder: Path, caller_path: Path) -> None: """ This internal function is needed because one cannot call a fixture directly since pytest 4.0 """ for name, definition in files.items(): - destination = tmp_path / name + destination = current_folder / name if isinstance(definition, Fileish): - definition.copy_to(destination, request.path.parent) + definition.copy_to(destination, caller_path) else: # Initialize subdirectory destination.mkdir() - _init_files(definition, destination, request) + _init_files(definition, destination, caller_path) def with_files(*files: FileDeclaration) -> Callable[[Any], Callable[[Any], None]]: @@ -201,5 +201,5 @@ def files(env: ManagedEnv, request: pytest.FixtureRequest) -> Path: """ home = env.dirs.home if hasattr(request, "param"): - _init_files(request.param, home, request) + _init_files(request.param, home, request.path.parent) return home