• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2019 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.
14
15package android
16
17import (
18	"io/ioutil"
19	"os"
20	"testing"
21)
22
23var buildDir string
24
25func setUp() {
26	var err error
27	buildDir, err = ioutil.TempDir("", "soong_android_test")
28	if err != nil {
29		panic(err)
30	}
31}
32
33func tearDown() {
34	os.RemoveAll(buildDir)
35}
36
37func TestMain(m *testing.M) {
38	run := func() int {
39		setUp()
40		defer tearDown()
41
42		return m.Run()
43	}
44
45	os.Exit(run())
46}
47