1#!/bin/bash 2 3# This script generats expected parse results as protobuf files in text format. 4# They will be used in unit tests to validate Parsers. 5# A typical flow is as follows: 6# 1. add the file name in targetFile below after adding a new object file in ./resources 7# 2. run: ./generate_golden_sample_files.sh 8# 3. manully validate the content of output protobuf files 9# 4. update UnitTests & respective test code to use the new files 10# 5. build: make release-parser release-parser-tests -j10 11# 6. test: ./cts/tools/release-parser/tests/run_test.sh 12 13echo Generating golden sample files for parser validation 14TargetFiles="HelloActivity.apk CtsJniTestCases.apk Shell.apk" 15for file in $TargetFiles; do 16 echo Processing $file 17 java -cp $ANDROID_HOST_OUT/framework/release-parser.jar com.android.cts.releaseparser.ApkParser -i resources/$file -of resources/$file.pb.txt 18done 19 20TargetFiles="libEGL.so" 21for file in $TargetFiles; do 22 echo Processing $file 23 java -cp $ANDROID_HOST_OUT/framework/release-parser.jar com.android.cts.releaseparser.SoParser -i resources/$file -pi -of resources/$file.pb.txt 24done 25 26TargetFiles="CtsAslrMallocTestCases32" 27for file in $TargetFiles; do 28 echo Processing $file 29 java -cp $ANDROID_HOST_OUT/framework/release-parser.jar com.android.cts.releaseparser.SoParser -i resources/$file -of resources/$file.pb.txt 30done 31 32TargetFiles="android.test.runner.vdex" 33for file in $TargetFiles; do 34 echo Processing $file 35 java -cp $ANDROID_HOST_OUT/framework/release-parser.jar com.android.cts.releaseparser.VdexParser -i resources/$file -of resources/$file.pb.txt 36done 37 38TargetFiles="android.test.runner.odex" 39for file in $TargetFiles; do 40 echo Processing $file 41 java -cp $ANDROID_HOST_OUT/framework/release-parser.jar com.android.cts.releaseparser.OdexParser -i resources/$file -of resources/$file.pb.txt 42done 43 44TargetFiles="boot-framework.oat" 45for file in $TargetFiles; do 46 echo Processing $file 47 java -cp $ANDROID_HOST_OUT/framework/release-parser.jar com.android.cts.releaseparser.OatParser -i resources/$file -of resources/$file.pb.txt 48done 49 50TargetFiles="boot-framework.art" 51for file in $TargetFiles; do 52 echo Processing $file 53 java -cp $ANDROID_HOST_OUT/framework/release-parser.jar com.android.cts.releaseparser.ArtParser -i resources/$file -of resources/$file.pb.txt 54done 55 56TargetFiles="platform.xml android.hardware.vulkan.version.xml" 57for file in $TargetFiles; do 58 echo Processing $file 59 java -cp $ANDROID_HOST_OUT/framework/release-parser.jar com.android.cts.releaseparser.XmlParser -i resources/$file -of resources/$file.pb.txt 60done 61 62TargetFiles="build.prop" 63for file in $TargetFiles; do 64 echo Processing $file 65 java -cp $ANDROID_HOST_OUT/framework/release-parser.jar com.android.cts.releaseparser.BuildPropParser -i resources/$file -of resources/$file.pb.txt 66done 67