File: generate-test-scripts.sh

package info (click to toggle)
android-platform-tools-apksig 30.0.3-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 7,464 kB
  • sloc: java: 20,312; sh: 218; makefile: 32
file content (31 lines) | stat: -rwxr-xr-x 1,093 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh -e
#

set -x
test -d ../../debian/tests || (echo "run in debian/tests/ subdir of package"; exit 1)
basedir=$(cd $(dirname $0)/../..; pwd)

cat <<EOF > $basedir/debian/tests/ApkVerifierTest.sh
#!/bin/sh -e
set -x

# test -J args from apksigner shell script
apksigner -JXmx256M verify src/test/resources/com/android/apksig/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.1-1024.apk

EOF

cd $basedir

for f in $(ls -1 `grep -A1 'assertVerifiedForEach(' src/test/java/com/android/apksig/ApkVerifierTest.java \
  | grep -Eo '"v[12]-.*\.apk"' \
  | sed -e 's,%s,[0-9p][0-9]*,' -e 's,^",src/test/resources/com/android/apksig/,' -e 's,",,g'`); do
    echo apksigner verify $f  >> $basedir/debian/tests/ApkVerifierTest.sh
done

for f in `grep -A1 'assertVerificationFailure(' src/test/java/com/android/apksig/ApkVerifierTest.java \
  | grep -Eo ' "v[12]-.*\.apk"' \
  | sed -e 's,^ ",src/test/resources/com/android/apksig/,' -e 's,",,g'`; do
    echo '! apksigner verify' $f  >> $basedir/debian/tests/ApkVerifierTest.sh
done

echo "echo SUCCESS" >> $basedir/debian/tests/ApkVerifierTest.sh