blob: 80e21caaaae54e9d6c82f3ca8e950d429fc37e6f [file] [log] [blame]
Anton Hanssonc02eb522020-12-30 11:33:31 +00001#!/bin/bash -e
2#
3# Copyright (C) 2021 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Verifies the tool correctly prints the binary representation of a db.
18function test_print_binary() {
19 # Golden binary rep generated with:
20 # $ gqui from textproto:testdata/test_extensions_db.textpb \
21 # proto extensions_db.proto:ExtensionDatabase \
22 # --outfile rawproto:- | xxd -p
23 cat > golden_binary << EOF
240a0a080112060803120208010a1a08021206080312020801120608021202
25080212060801120208020a1a080312060803120208031206080212020802
2612060801120208020a220804120608031202080312060802120208021206
270801120208041206080512020804
28EOF
29
30 diff golden_binary <(gen_sdk --action print_binary --database testdata/test_extensions_db.textpb | xxd -p)
31}
32test_print_binary
Anton Hanssonc6328fe2020-12-30 11:33:31 +000033
34# Verifies the tool is able to re-create the test DB correctly.
35function test_new_sdk() {
36 rm -f extensions_db.textpb && touch extensions_db.textpb
37 gen_sdk --action new_sdk --sdk 1 --modules MEDIA_PROVIDER
38 gen_sdk --action new_sdk --sdk 2 --modules MEDIA,IPSEC
39 gen_sdk --action new_sdk --sdk 3 --modules MEDIA_PROVIDER
40 gen_sdk --action new_sdk --sdk 4 --modules SDK_EXTENSIONS,IPSEC
41
42 diff -u0 testdata/test_extensions_db.textpb extensions_db.textpb
43}
44test_new_sdk