1a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe/*
2a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe * Copyright (C) 2014 The Android Open Source Project
3a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe *
4a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe * Licensed under the Apache License, Version 2.0 (the "License");
5a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe * you may not use this file except in compliance with the License.
6a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe * You may obtain a copy of the License at
7a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe *
8a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe *      http://www.apache.org/licenses/LICENSE-2.0
9a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe *
10a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe * Unless required by applicable law or agreed to in writing, software
11a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe * distributed under the License is distributed on an "AS IS" BASIS,
12a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe * See the License for the specific language governing permissions and
14a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe * limitations under the License.
15a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe */
16a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe
17a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe#include "NativeBridgeTest.h"
18a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe
19a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe#include <signal.h>
20a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe#include <unistd.h>
21a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe
22a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampenamespace android {
23a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe
24a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampeconstexpr const char* kNativeBridgeLibrary2 = "libnativebridge2-dummy.so";
25a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe
26a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas GampeTEST_F(NativeBridgeTest, V2_Signal) {
27a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe    // Init
28a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe    ASSERT_TRUE(LoadNativeBridge(kNativeBridgeLibrary2, nullptr));
29a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe    ASSERT_TRUE(NativeBridgeAvailable());
30a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe    ASSERT_TRUE(PreInitializeNativeBridge(".", "isa"));
31a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe    ASSERT_TRUE(NativeBridgeAvailable());
32a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe    ASSERT_TRUE(InitializeNativeBridge(nullptr, nullptr));
33a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe    ASSERT_TRUE(NativeBridgeAvailable());
34a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe
35a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe    ASSERT_EQ(2U, NativeBridgeGetVersion());
36a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe    ASSERT_NE(nullptr, NativeBridgeGetSignalHandler(SIGSEGV));
37a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe
38a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe    // Clean-up code_cache
39a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe    ASSERT_EQ(0, rmdir(kCodeCache));
40a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe}
41a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe
42a6ac9ce98bd38099a4e89010111d14e4d5fc190eAndreas Gampe}  // namespace android
43