2022-10-04 20:03:31 +02:00
|
|
|
// Copyright 2022 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package java
|
|
|
|
|
|
|
|
import (
|
2022-10-06 22:38:24 +02:00
|
|
|
"runtime"
|
2023-07-13 12:03:38 +02:00
|
|
|
"sort"
|
2022-10-04 20:03:31 +02:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"android/soong/android"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestBootImageConfig(t *testing.T) {
|
2022-10-06 22:38:24 +02:00
|
|
|
if runtime.GOOS != "linux" {
|
2022-10-07 12:46:31 +02:00
|
|
|
t.Skipf("Skipping as boot image config test is only supported on linux not %s", runtime.GOOS)
|
2022-10-06 22:38:24 +02:00
|
|
|
}
|
|
|
|
|
2022-10-04 20:03:31 +02:00
|
|
|
result := android.GroupFixturePreparers(
|
|
|
|
PrepareForBootImageConfigTest,
|
2023-03-06 20:16:48 +01:00
|
|
|
PrepareApexBootJarConfigs,
|
2022-10-04 20:03:31 +02:00
|
|
|
).RunTest(t)
|
|
|
|
|
|
|
|
CheckArtBootImageConfig(t, result)
|
|
|
|
CheckFrameworkBootImageConfig(t, result)
|
2023-03-06 20:16:48 +01:00
|
|
|
CheckMainlineBootImageConfig(t, result)
|
2022-10-04 20:03:31 +02:00
|
|
|
}
|
2023-07-13 12:03:38 +02:00
|
|
|
|
|
|
|
func TestImageNames(t *testing.T) {
|
|
|
|
result := android.GroupFixturePreparers(
|
|
|
|
PrepareForBootImageConfigTest,
|
|
|
|
).RunTest(t)
|
|
|
|
|
|
|
|
names := getImageNames()
|
|
|
|
sort.Strings(names)
|
|
|
|
|
|
|
|
ctx := &android.TestPathContext{TestResult: result}
|
|
|
|
configs := genBootImageConfigs(ctx)
|
|
|
|
namesFromConfigs := make([]string, 0, len(configs))
|
|
|
|
for name, _ := range configs {
|
|
|
|
namesFromConfigs = append(namesFromConfigs, name)
|
|
|
|
}
|
|
|
|
sort.Strings(namesFromConfigs)
|
|
|
|
|
|
|
|
android.AssertArrayString(t, "getImageNames vs genBootImageConfigs", names, namesFromConfigs)
|
|
|
|
}
|