Nicolas Geoffray | 21b6568 | 2019-03-12 00:49:45 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "dexopt_test.h" |
| 18 | #include "runtime.h" |
| 19 | #include "scoped_thread_state_change-inl.h" |
| 20 | #include "thread.h" |
| 21 | |
| 22 | namespace art { |
| 23 | |
| 24 | // This test creates two runtimes consecutively to check that state is |
| 25 | // setup and cleaned-up correctly each time. |
| 26 | |
| 27 | // Make this a DexoptTest, which makes sure runtime images get mapped |
| 28 | // at random addresses. |
| 29 | class TwoRuntimesTest : public DexoptTest {}; |
| 30 | |
| 31 | TEST_F(TwoRuntimesTest, FirstInvocation) { |
| 32 | Thread::Current()->TransitionFromSuspendedToRunnable(); |
| 33 | runtime_->Start(); |
| 34 | } |
| 35 | |
| 36 | TEST_F(TwoRuntimesTest, SecondInvocation) { |
| 37 | Thread::Current()->TransitionFromSuspendedToRunnable(); |
| 38 | runtime_->Start(); |
| 39 | } |
| 40 | |
| 41 | } // namespace art |