diff options
| author | Julian Andres Klode <jak@debian.org> | 2024-11-28 18:25:02 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2024-11-28 18:25:02 +0000 |
| commit | 46e45bf1f4658075f87985d543414e45186e72d2 (patch) | |
| tree | 7259447c78be773163b348c196f9a59577f40427 /test | |
| parent | 8d66ab29191c59baac04ef89fac30630cf9535e9 (diff) | |
| parent | 86f8353ce7a343db7b19422db0d37379ac45ff4e (diff) | |
Merge branch 'prep-bye-apt-key' into 'main'
Stop using apt-key
See merge request apt-team/apt!407
Diffstat (limited to 'test')
| -rw-r--r-- | test/integration/framework | 9 | ||||
| -rwxr-xr-x | test/integration/test-method-gpgv | 22 | ||||
| -rw-r--r-- | test/libapt/fileutl_test.cc | 2 | ||||
| -rw-r--r-- | test/libapt/strutil_test.cc | 21 |
4 files changed, 33 insertions, 21 deletions
diff --git a/test/integration/framework b/test/integration/framework index ad87d17c7..a64488f0e 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -457,15 +457,8 @@ _setupprojectenvironment() { echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf echo "Binary::apt::APT::Output-Version \"0\";" >> aptconfig.conf echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf - # either store apt-key were we can access it, even if we run it as a different user - #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" - #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" - #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf - # destroys coverage reporting though, so we disable changing user for the calling gpgv - echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf if [ "$(id -u)" = '0' ]; then - echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf - # same for the solver executables + # run the solvers as root so we don't lose coverage data echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf fi diff --git a/test/integration/test-method-gpgv b/test/integration/test-method-gpgv index ffaa72c8f..5ce685c8b 100755 --- a/test/integration/test-method-gpgv +++ b/test/integration/test-method-gpgv @@ -7,7 +7,7 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" setupenvironment configarchitecture 'i386' -cat > faked-apt-key <<EOF +cat > faked-gpgv <<EOF #!/bin/sh set -e find_gpgv_status_fd() { @@ -24,7 +24,7 @@ GPGSTATUSFD="\$(find_gpgv_status_fd "\$@")" cat >&\${GPGSTATUSFD} gpgv.output cat gpgv.output EOF -chmod +x faked-apt-key +chmod +x faked-gpgv testgpgv() { echo "$4" > gpgv.output @@ -114,7 +114,7 @@ EOF gpgvmethod() { echo "601 Configuration Config-Item: Debug::Acquire::gpgv=1 -Config-Item: Dir::Bin::apt-key=./faked-apt-key +Config-Item: APT::Key::GPGVCommand=$PWD/faked-gpgv Config-Item: APT::Hashes::SHA1::Weak=true Config-Item: APT::Key::Assert-Pubkey-Algo=>=rsa2048,nistp256,brainpoolP256r1 Config-Item: APT::Key::Assert-Pubkey-Algo::Next=>=rsa2048,nistp256 @@ -130,7 +130,7 @@ testrun gpgvmethod() { echo "601 Configuration Config-Item: Debug::Acquire::gpgv=1 -Config-Item: Dir::Bin::apt-key=./faked-apt-key +Config-Item: APT::Key::GPGVCommand=$PWD/faked-gpgv Config-Item: APT::Hashes::SHA1::Weak=true Config-Item: APT::Key::Assert-Pubkey-Algo=>=rsa2048,nistp256,brainpoolP256r1 Config-Item: APT::Key::Assert-Pubkey-Algo::Next=>=rsa2048,nistp256 @@ -147,7 +147,7 @@ testrun gpgvmethod() { echo "601 Configuration Config-Item: Debug::Acquire::gpgv=1 -Config-Item: Dir::Bin::apt-key=./faked-apt-key +Config-Item: APT::Key::GPGVCommand=$PWD/faked-gpgv Config-Item: APT::Hashes::SHA1::Weak=true Config-Item: APT::Key::Assert-Pubkey-Algo=>=rsa2048,nistp256,brainpoolP256r1 Config-Item: APT::Key::Assert-Pubkey-Algo::Next=>=rsa2048,nistp256 @@ -173,7 +173,7 @@ testsuccess grep 'verified because the public key is not available: GOODSIG' met gpgvmethod() { echo "601 Configuration Config-Item: Debug::Acquire::gpgv=1 -Config-Item: Dir::Bin::apt-key=./faked-apt-key +Config-Item: APT::Key::GPGVCommand=$PWD/faked-gpgv Config-Item: APT::Hashes::SHA1::Weak=true Config-Item: APT::Key::Assert-Pubkey-Algo=>=rsa2048,nistp256,brainpoolP256r1 Config-Item: APT::Key::Assert-Pubkey-Algo::Next=>=rsa2048,nistp256 @@ -204,26 +204,26 @@ setupaptarchive --no-update echo '[GNUPG:] GOODSIG 5A90D141DBAC8DAE Sebastian Subkey <subkey@example.org> [GNUPG:] VALIDSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 2018-08-16 1534459673 0 4 0 1 11 00 4281DEDBD466EAE8C1F4157E5B6896415D44C43E' > gpgv.output -testsuccess apt update -o Dir::Bin::apt-key="./faked-apt-key" -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::gpgv=1 +testsuccess apt update -o APT::Key::GPGVCommand="$PWD/faked-gpgv" -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::gpgv=1 rm -rf rootdir/var/lib/apt/lists echo '[GNUPG:] GOODSIG 5A90D141DBAC8DAE Sebastian Subkey <subkey@example.org>' > gpgv.output -testfailure apt update -o Dir::Bin::apt-key="./faked-apt-key" -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::gpgv=1 +testfailure apt update -o APT::Key::GPGVCommand="$PWD/faked-gpgv" -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::gpgv=1 rm -rf rootdir/var/lib/apt/lists echo '[GNUPG:] VALIDSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 2018-08-16 1534459673 0 4 0 1 11 00 4281DEDBD466EAE8C1F4157E5B6896415D44C43E' > gpgv.output -testfailure apt update -o Dir::Bin::apt-key="./faked-apt-key" -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::gpgv=1 +testfailure apt update -o APT::Key::GPGVCommand="$PWD/faked-gpgv" -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::gpgv=1 rm -rf rootdir/var/lib/apt/lists echo '[GNUPG:] GOODSIG 5A90D141DBAC8DAE Sebastian Subkey <subkey@example.org> [GNUPG:] VALIDSIG 0000000000000000000000000000000000000000 2018-08-16 1534459673 0 4 0 1 11 00 4281DEDBD466EAE8C1F4157E5B6896415D44C43E' > gpgv.output -testfailure apt update -o Dir::Bin::apt-key="./faked-apt-key" -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::gpgv=1 +testfailure apt update -o APT::Key::GPGVCommand="$PWD/faked-gpgv" -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::gpgv=1 rm -rf rootdir/var/lib/apt/lists gpgvmethod() { echo "601 Configuration Config-Item: Debug::Acquire::gpgv=1 -Config-Item: Dir::Bin::apt-key=./faked-apt-key +Config-Item: APT::Key::GPGVCommand=$PWD/faked-gpgv Config-Item: APT::Hashes::SHA1::Weak=true Config-Item: APT::Key::Assert-Pubkey-Algo::Next=>=invalid diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc index b35a2d45e..2badf5465 100644 --- a/test/libapt/fileutl_test.cc +++ b/test/libapt/fileutl_test.cc @@ -288,7 +288,7 @@ TEST(FileUtlTest, Popen) OpenFds = Glob("/proc/self/fd/*"); // output something - const char* Args[10] = {"/bin/echo", "meepmeep", NULL}; + const char* Args[10] = {"echo", "meepmeep", NULL}; EXPECT_TRUE(Popen(Args, Fd, Child, FileFd::ReadOnly)); EXPECT_TRUE(Fd.Read(buf, sizeof(buf)-1, &n)); buf[n] = 0; diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index 500ba98da..9320f8fa9 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -179,6 +179,24 @@ TEST(StrUtilTest,Base64Encode) EXPECT_EQ("/A==", Base64Encode("\xfc")); EXPECT_EQ("//8=", Base64Encode("\xff\xff")); } +TEST(StrUtilTest,Base64Decode) +{ + EXPECT_EQ(Base64Decode("QWxhZGRpbjpvcGVuIHNlc2FtZQ=="), "Aladdin:open sesame"); + EXPECT_EQ(Base64Decode("cGxlYXN1cmUu"), "pleasure."); + EXPECT_EQ(Base64Decode("bGVhc3VyZS4="), "leasure."); + EXPECT_EQ(Base64Decode("ZWFzdXJlLg=="), "easure."); + EXPECT_EQ(Base64Decode("YXN1cmUu"), "asure."); + EXPECT_EQ(Base64Decode("c3VyZS4="), "sure."); + EXPECT_EQ(Base64Decode("dXJlLg=="), "ure."); + EXPECT_EQ(Base64Decode("cmUu"), "re."); + EXPECT_EQ(Base64Decode("ZS4="), "e."); + EXPECT_EQ(Base64Decode("Lg=="), "."); + EXPECT_EQ(Base64Decode(""), ""); + EXPECT_EQ(Base64Decode("IA=="), "\x20"); + EXPECT_EQ(Base64Decode("/w=="), "\xff"); + EXPECT_EQ(Base64Decode("/A=="), "\xfc"); + EXPECT_EQ(Base64Decode("//8="), "\xff\xff"); +} static void ReadMessagesTestWithNewLine(char const * const nl, char const * const ab) { SCOPED_TRACE(SubstVar(SubstVar(nl, "\n", "n"), "\r", "r") + " # " + ab); @@ -318,7 +336,8 @@ TEST(StrUtilTest,RFC1123StrToTime) time_t t; EXPECT_TRUE(RFC1123StrToTime("Sun, 06 Nov 1994 08:49:37 GMT", t)); EXPECT_EQ(784111777, t); - } { + } + { time_t t; EXPECT_TRUE(RFC1123StrToTime("Sun, 6 Nov 1994 08:49:37 UTC", t)); EXPECT_EQ(784111777, t); |
