| Colin Cross | 2ffb9a8 | 2019-06-10 14:32:38 -0700 | [diff] [blame] | 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 |  | 
|  | 15 | package android | 
|  | 16 |  | 
|  | 17 | import ( | 
| Colin Cross | 14ec66c | 2022-10-03 21:02:27 -0700 | [diff] [blame] | 18 | "io/ioutil" | 
| Colin Cross | 2ffb9a8 | 2019-06-10 14:32:38 -0700 | [diff] [blame] | 19 | "os" | 
|  | 20 | "testing" | 
|  | 21 | ) | 
|  | 22 |  | 
| Colin Cross | 14ec66c | 2022-10-03 21:02:27 -0700 | [diff] [blame] | 23 | var buildDir string | 
|  | 24 |  | 
|  | 25 | func setUp() { | 
|  | 26 | var err error | 
|  | 27 | buildDir, err = ioutil.TempDir("", "android_test") | 
|  | 28 | if err != nil { | 
|  | 29 | panic(err) | 
|  | 30 | } | 
|  | 31 | } | 
|  | 32 |  | 
|  | 33 | func tearDown() { | 
|  | 34 | os.RemoveAll(buildDir) | 
|  | 35 | } | 
|  | 36 |  | 
| Colin Cross | 2ffb9a8 | 2019-06-10 14:32:38 -0700 | [diff] [blame] | 37 | func TestMain(m *testing.M) { | 
| Colin Cross | 14ec66c | 2022-10-03 21:02:27 -0700 | [diff] [blame] | 38 | run := func() int { | 
|  | 39 | setUp() | 
|  | 40 | defer tearDown() | 
|  | 41 |  | 
|  | 42 | return m.Run() | 
|  | 43 | } | 
|  | 44 |  | 
|  | 45 | os.Exit(run()) | 
| Colin Cross | 2ffb9a8 | 2019-06-10 14:32:38 -0700 | [diff] [blame] | 46 | } |