blob: 647ba4d436128027a9cf240032476ebaa5275690 [file] [log] [blame]
Weijia He32282f62024-11-05 22:21:04 +00001// Copyright 2024 Google Inc. All rights reserved.
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.
14package tradefed_modules
15
16import (
17 "android/soong/android"
18 "android/soong/java"
19 "testing"
20)
21
22func TestTestSuites(t *testing.T) {
23 t.Parallel()
Weijia Heaa37c162024-11-06 19:46:03 +000024 ctx := android.GroupFixturePreparers(
Weijia He32282f62024-11-05 22:21:04 +000025 java.PrepareForTestWithJavaDefaultModules,
26 android.FixtureRegisterWithContext(RegisterTestSuiteBuildComponents),
27 ).RunTestWithBp(t, `
28 android_test {
29 name: "TestModule1",
30 sdk_version: "current",
31 }
32
33 android_test {
34 name: "TestModule2",
35 sdk_version: "current",
36 }
37
38 test_suite {
39 name: "my-suite",
40 description: "a test suite",
41 tests: [
42 "TestModule1",
43 "TestModule2",
44 ]
45 }
46 `)
Weijia Heaa37c162024-11-06 19:46:03 +000047 manifestPath := ctx.ModuleForTests("my-suite", "").Output("out/soong/test_suites/my-suite/my-suite.json")
48 got := android.ContentFromFileRuleForTests(t, ctx.TestContext, manifestPath)
49 want := `{"name": "my-suite"}` + "\n"
50 if got != want {
51 t.Errorf("my-suite.json content was %q, want %q", got, want)
52 }
Weijia He32282f62024-11-05 22:21:04 +000053}