blob: bc09bbc4c2cb1713647a74c4bd3f49b150f65feb [file] [log] [blame]
Paul Duffinf7f65da2021-03-10 15:00:46 +00001// Copyright (C) 2021 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package sdk
16
Paul Duffin4a1d4512021-03-18 10:12:26 +000017import (
18 "testing"
19
20 "android/soong/android"
21)
Paul Duffinf7f65da2021-03-10 15:00:46 +000022
23func TestSnapshotWithBootImage(t *testing.T) {
Paul Duffin4a1d4512021-03-18 10:12:26 +000024 result := android.GroupFixturePreparers(
25 prepareForSdkTestWithJava,
26 android.FixtureWithRootAndroidBp(`
27 sdk {
28 name: "mysdk",
29 boot_images: ["mybootimage"],
30 }
Paul Duffinf7f65da2021-03-10 15:00:46 +000031
Paul Duffin4a1d4512021-03-18 10:12:26 +000032 boot_image {
33 name: "mybootimage",
34 image_name: "art",
35 }
36 `),
37 ).RunTest(t)
Paul Duffinf7f65da2021-03-10 15:00:46 +000038
Paul Duffin36474d32021-03-12 12:19:43 +000039 CheckSnapshot(t, result, "mysdk", "",
Paul Duffinf7f65da2021-03-10 15:00:46 +000040 checkUnversionedAndroidBpContents(`
41// This is auto-generated. DO NOT EDIT.
42
43prebuilt_boot_image {
44 name: "mybootimage",
45 prefer: false,
46 visibility: ["//visibility:public"],
47 apex_available: ["//apex_available:platform"],
48 image_name: "art",
49}
50`),
51 checkVersionedAndroidBpContents(`
52// This is auto-generated. DO NOT EDIT.
53
54prebuilt_boot_image {
55 name: "mysdk_mybootimage@current",
56 sdk_member_name: "mybootimage",
57 visibility: ["//visibility:public"],
58 apex_available: ["//apex_available:platform"],
59 image_name: "art",
60}
61
62sdk_snapshot {
63 name: "mysdk@current",
64 visibility: ["//visibility:public"],
65 boot_images: ["mysdk_mybootimage@current"],
66}
67`),
Paul Duffin36474d32021-03-12 12:19:43 +000068 checkAllCopyRules(""))
Paul Duffinf7f65da2021-03-10 15:00:46 +000069}