blob: 64ceedc4d8375b2c57607d813c461f68fae9f07a [file] [log] [blame]
Colin Cross2ffb9a82019-06-10 14:32:38 -07001// 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 (
Colin Cross14ec66c2022-10-03 21:02:27 -070018 "io/ioutil"
Colin Cross2ffb9a82019-06-10 14:32:38 -070019 "os"
20 "testing"
21)
22
Colin Cross14ec66c2022-10-03 21:02:27 -070023var buildDir string
24
25func setUp() {
26 var err error
27 buildDir, err = ioutil.TempDir("", "android_test")
28 if err != nil {
29 panic(err)
30 }
31}
32
33func tearDown() {
34 os.RemoveAll(buildDir)
35}
36
Colin Cross2ffb9a82019-06-10 14:32:38 -070037func TestMain(m *testing.M) {
Colin Cross14ec66c2022-10-03 21:02:27 -070038 run := func() int {
39 setUp()
40 defer tearDown()
41
42 return m.Run()
43 }
44
45 os.Exit(run())
Colin Cross2ffb9a82019-06-10 14:32:38 -070046}