File: compare_images_and_print.sh

package info (click to toggle)
android-platform-tools 35.0.2-1~exp6
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 211,716 kB
  • sloc: cpp: 995,749; java: 290,495; ansic: 145,647; xml: 58,531; python: 39,608; sh: 14,500; javascript: 5,198; asm: 4,866; makefile: 3,115; yacc: 769; awk: 368; ruby: 183; sql: 140; perl: 88; lex: 67
file content (68 lines) | stat: -rwxr-xr-x 1,343 bytes parent folder | download
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash

set -e

PROGNAME="$0"

function usage {
  cat <<EOF
Usage:
    ${PROGNAME} [OPTION] ... "[Args for compare_images]"

Options:
    -h, --help
        Show this message and exit.
    -c, --check
        Exit with a non-zero status if there is any unexpected diffs.
EOF
}

while [[ "$1" =~ ^- ]] && [[ "$1" != "--" ]]; do
  case "$1" in
    -h | --help)
      usage
      exit 0
      ;;
    -c | --check)
      CHECK_DIFF_RESULT=1
      ;;
    *)
      break
      ;;
  esac
  shift
done
if [ "$1" == "--" ]; then
  shift
fi

readonly CHECK_DIFF_RESULT

. build/envsetup.sh
lunch aosp_arm64-next-userdebug
build/soong/soong_ui.bash --make-mode compare_images
COMMON_ALLOWLIST=development/vndk/tools/image-diff-tool/allowlist.txt
out/host/linux-x86/bin/compare_images $1 -u -w "${COMMON_ALLOWLIST}"

if [ -v DIST_DIR ]; then
  cp common.csv diff.csv allowlisted_diff.csv "${DIST_DIR}"
fi

echo >&2
echo >&2 " - Different parts (that are allowlisted)"
cat >&2 allowlisted_diff.csv
echo >&2
echo >&2 " - Different parts (that are not allowlisted)"
cat >&2 diff.csv

if [ "$(wc -l diff.csv | cut -d' ' -f1)" -gt "1" ]; then
  cat >&2 <<EOF

[ERROR] Unexpected diffing files.
There are diffing files that are not ignored by allowlist.
The allowlist may need to be updated.
EOF
  if [ -n "${CHECK_DIFF_RESULT}" ]; then
    exit 1
  fi
fi