Revert "[appmgmt] Add tests for register_app and unregister_app syscalls"
This reverts commit 4c1d471a6ac8a93a30447b1eac94f49482f176b9.
Bug: 130560272
Change-Id: I9f887d74afcf10596545c285d1268e19b9d46ba5
diff --git a/app-mgmt-test/include/app_mgmt_test.h b/app-mgmt-test/include/app_mgmt_test.h
index 72a5320..30bcb6f 100644
--- a/app-mgmt-test/include/app_mgmt_test.h
+++ b/app-mgmt-test/include/app_mgmt_test.h
@@ -27,29 +27,9 @@
#define START_PORT "com.android.trusty.appmgmt.portstartsrv"
#define CTRL_PORT "com.android.trusty.appmgmt.portstartsrv.ctrl"
#define SHUTDOWN_PORT "com.android.trusty.appmgmt.portstartsrv.shutdown"
-#define LOADABLE_PORT "com.android.trusty.appmgmt.loadable"
-#define LOADABLE_START_PORT "com.android.trusty.appmgmt.loadable.start"
#define MAX_CMD_LEN 1
-#define LOAD_START_UUID \
- { \
- 0x979f88fb, 0x2928, 0x4295, \
- {0xb2, 0x74, 0x97, 0x59, 0x5a, 0xb5, 0x34, 0x9e}, \
- }
-
-#define PORT_START_UUID \
- { \
- 0xc14672f9, 0x6a19, 0x4e3e, \
- {0x9b, 0x27, 0x0c, 0xd6, 0x02, 0x4d, 0xe4, 0x01}, \
- }
-
-#define BUILTIN_UUID \
- { \
- 0x0d5471ec, 0x2113, 0x4320, \
- {0x80, 0x7f, 0xfa, 0x95, 0xdc, 0x60, 0x89, 0x9f}, \
- }
-
enum {
CMD_NOP = 0,
CMD_CLOSE_PORT = 1,
diff --git a/app-mgmt-test/syscalls-test/aux/main.c b/app-mgmt-test/syscalls-test/aux/main.c
deleted file mode 100644
index c94c3c3..0000000
--- a/app-mgmt-test/syscalls-test/aux/main.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <lib/unittest/unittest.h>
-#include <trusty_app_mgmt.h>
-#include <trusty_unittest.h>
-#include <uapi/err.h>
-
-#define TLOG_TAG "app-mgmt-syscalls-test-aux"
-#define PORT_BASE "com.android.appmgmt-unittest.syscalls.aux"
-
-TEST(AppMgmtSyscalls, RegisterAppNoAccess) {
- int rc;
-
- rc = register_app((void*)USER_ASPACE_BASE, 0x8000);
- EXPECT_EQ(ERR_ACCESS_DENIED, rc);
-}
-
-TEST(AppMgmtSyscalls, UnregisterAppNoAccess) {
- int rc;
- uuid_t uuid;
-
- memset(&uuid, 0xff, sizeof(uuid_t));
- rc = unregister_app(&uuid);
- EXPECT_EQ(ERR_ACCESS_DENIED, rc);
-}
-
-PORT_TEST(AppMgmtSyscalls, PORT_BASE);
diff --git a/app-mgmt-test/syscalls-test/aux/manifest.c b/app-mgmt-test/syscalls-test/aux/manifest.c
deleted file mode 100644
index 6d7e346..0000000
--- a/app-mgmt-test/syscalls-test/aux/manifest.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <trusty_app_manifest.h>
-
-trusty_app_manifest_t TRUSTY_APP_MANIFEST_ATTRS trusty_app_manifest = {
- /* UUID : {16470da3-fa7e-4637-9082-e1a06cd0a1d4} */
- {0x16470da3,
- 0xfa76,
- 0x4637,
- {0x90, 0x82, 0xe1, 0xa0, 0x6c, 0xd0, 0xa1, 0xd4}},
-
- /* optional configuration options here */
- {
- TRUSTY_APP_CONFIG_MIN_HEAP_SIZE(1 * 4096),
- },
-};
diff --git a/app-mgmt-test/syscalls-test/aux/rules.mk b/app-mgmt-test/syscalls-test/aux/rules.mk
deleted file mode 100644
index aeceedd..0000000
--- a/app-mgmt-test/syscalls-test/aux/rules.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2019 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_DIR := $(GET_LOCAL_DIR)
-
-MODULE := $(LOCAL_DIR)
-
-MODULE_INCLUDES +=\
- $(LOCAL_DIR)/../../include \
-
-MODULE_SRCS += \
- $(LOCAL_DIR)/main.c \
- $(LOCAL_DIR)/manifest.c \
-
-MODULE_DEPS += \
- trusty/user/base/lib/libc-trusty \
- trusty/user/base/lib/tipc \
- trusty/user/base/lib/unittest \
-
-include make/module.mk
diff --git a/app-mgmt-test/syscalls-test/builtin/main.c b/app-mgmt-test/syscalls-test/builtin/main.c
deleted file mode 100644
index 7f64ca5..0000000
--- a/app-mgmt-test/syscalls-test/builtin/main.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <trusty_log.h>
-
-#define TLOG_TAG "app-mgmt-syscalls-test-builtin"
-
-int main(void) {
- TLOGE("Builtin test app should never start\n");
- return 0;
-}
diff --git a/app-mgmt-test/syscalls-test/builtin/manifest.c b/app-mgmt-test/syscalls-test/builtin/manifest.c
deleted file mode 100644
index e55773e..0000000
--- a/app-mgmt-test/syscalls-test/builtin/manifest.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <app_mgmt_test.h>
-#include <trusty_app_manifest.h>
-
-trusty_app_manifest_t TRUSTY_APP_MANIFEST_ATTRS trusty_app_manifest = {
- /* UUID : {0d5471ec-2113-4320-807f-fa95dc60899f} */
- .uuid = BUILTIN_UUID,
- /* optional configuration options here */
- {
- TRUSTY_APP_CONFIG_MIN_HEAP_SIZE(1 * 4096),
- TRUSTY_APP_CONFIG_MGMT_FLAGS(
- TRUSTY_APP_MGMT_FLAGS_DEFERRED_START),
- },
-};
diff --git a/app-mgmt-test/syscalls-test/builtin/rules.mk b/app-mgmt-test/syscalls-test/builtin/rules.mk
deleted file mode 100644
index 1722d16..0000000
--- a/app-mgmt-test/syscalls-test/builtin/rules.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (C) 2019 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_DIR := $(GET_LOCAL_DIR)
-
-MODULE := $(LOCAL_DIR)
-
-MODULE_INCLUDES +=\
- $(LOCAL_DIR)/../../include \
-
-MODULE_SRCS += \
- $(LOCAL_DIR)/main.c \
- $(LOCAL_DIR)/manifest.c \
-
-MODULE_DEPS += \
- trusty/user/base/lib/libc-trusty \
-
-include make/module.mk
diff --git a/app-mgmt-test/syscalls-test/main/appobj.S b/app-mgmt-test/syscalls-test/main/appobj.S
deleted file mode 100644
index 8e4f465..0000000
--- a/app-mgmt-test/syscalls-test/main/appobj.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.macro embed_bin name, path
-.section .data.loadable_apps.\name\(), "aw"
-.global _bin_\name\()_begin
-.type _bin_\name\()_begin, STT_OBJECT
-_bin_\name\()_begin:
-.incbin "\path"
-.global _bin_\name\()_end
-.type _bin_\name\()_end, STT_OBJECT
-_bin_\name\()_end:
-.endm
-
-embed_bin load_start, FILE_NAME_load_start
-embed_bin port_start, FILE_NAME_port_start
-embed_bin duplicate_port, FILE_NAME_duplicate_port
-
-
diff --git a/app-mgmt-test/syscalls-test/main/main.c b/app-mgmt-test/syscalls-test/main/main.c
deleted file mode 100644
index b2ac0ad..0000000
--- a/app-mgmt-test/syscalls-test/main/main.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <app_mgmt_test.h>
-#include <lib/tipc/tipc.h>
-#include <lib/unittest/unittest.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <time.h>
-#include <trusty_app_mgmt.h>
-#include <trusty_unittest.h>
-#include <uapi/err.h>
-#include <uapi/trusty_uuid.h>
-
-#define TLOG_TAG "app-mgmt-syscalls-test"
-#define PORT_BASE "com.android.appmgmt-unittest.syscalls"
-
-#define KERNEL_ADDRESS KERNEL_ASPACE_BASE
-#define INVALID_USER_ADDRESS (0x1000)
-
-#define TEST_DATA_BYTE 0x5a
-#define PAGE_SIZE 4096
-
-static uuid_t load_start_uuid = LOAD_START_UUID;
-static uuid_t port_start_uuid = PORT_START_UUID;
-static uuid_t builtin_uuid = BUILTIN_UUID;
-
-#define PRINT_UUID(u) \
- TLOGI("uuid:%02x-%02x-%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", \
- (u)->time_low, (u)->time_mid, (u)->time_hi_and_version, \
- (u)->clock_seq_and_node[0], (u)->clock_seq_and_node[1], \
- (u)->clock_seq_and_node[2], (u)->clock_seq_and_node[3], \
- (u)->clock_seq_and_node[4], (u)->clock_seq_and_node[5], \
- (u)->clock_seq_and_node[6], (u)->clock_seq_and_node[7]);
-/*
- * These tests make use of three loadable apps: load_start, port_start and
- * duplicate_port.
- *
- * load_start:
- * - Starts when loaded
- * - Waits on LOADABLE_PORT for a connection
- * - Exits after echoing a message
- *
- * port_start:
- * - Doesn't start when loaded
- * - Starts on connection to LOADABLE_START_PORT
- * - Waits on LOADABLE_START_PORT for a connection
- * - Exits after echoing a message
- *
- * duplicate_port:
- * - Declares LOADABLE_START_PORT in its manifest
- * - Prints an error and exits after starting
- */
-
-extern uint8_t _bin_load_start_begin[];
-extern uint8_t _bin_load_start_end[];
-
-extern uint8_t _bin_port_start_begin[];
-extern uint8_t _bin_port_start_end[];
-
-extern uint8_t _bin_duplicate_port_begin[];
-extern uint8_t _bin_duplicate_port_end[];
-
-/*
- * Best way we have now since app termination is asynchronous and there isn't
- * a good way to signal user space when an app has exited.
- */
-int unregister_app_poll(uuid_t* app_uuid) {
- int rc;
-
- rc = unregister_app(app_uuid);
-
- while (rc == ERR_BUSY) {
- trusty_nanosleep(0, 0, 0);
- rc = unregister_app(app_uuid);
- }
-
- if (rc != NO_ERROR) {
- TLOGI("Failed(%d) to unregister app\n", rc);
- PRINT_UUID(app_uuid);
- }
-
- return rc;
-}
-
-TEST(AppMgmtSyscalls, RegisterAppZeroSize) {
- int rc;
-
- rc = register_app(_bin_port_start_begin, 0);
- EXPECT_EQ(ERR_INVALID_ARGS, rc);
-}
-
-TEST(AppMgmtSyscalls, RegisterAppInvalidUserAddress) {
- int rc;
-
- rc = register_app((void*)INVALID_USER_ADDRESS, PAGE_SIZE);
- EXPECT_EQ(ERR_FAULT, rc);
-}
-
-TEST(AppMgmtSyscalls, RegisterAppKernelAddress) {
- int rc;
-
- rc = register_app((void*)KERNEL_ADDRESS, PAGE_SIZE);
- EXPECT_EQ(ERR_FAULT, rc);
-}
-
-TEST(AppMgmtSyscalls, RegisterAppInvalidApp) {
- int rc;
- uint8_t invalid_app[PAGE_SIZE * 2];
-
- memset(invalid_app, 0xff, sizeof invalid_app);
-
- rc = register_app(invalid_app, sizeof invalid_app);
- EXPECT_EQ(ERR_NOT_VALID, rc);
-}
-
-/*
- * This test tests three things that are tightly related and difficult to test
- * separately:
- *
- * 1. App registration
- * 2. DEFERRED_START for loadable apps
- * 3. App unregistration
- */
-TEST(AppMgmtSyscalls, RegisterUnregisterDeferredStartApp) {
- int rc;
- uint32_t img_size;
-
- /* Register port_start */
- img_size = _bin_port_start_end - _bin_port_start_begin;
- rc = register_app(_bin_port_start_begin, img_size);
- ASSERT_EQ(NO_ERROR, rc);
-
- /* Unregister port_start */
- rc = unregister_app_poll(&port_start_uuid);
- EXPECT_EQ(NO_ERROR, rc);
-
-test_abort:
- return;
-}
-
-TEST(AppMgmtSyscalls, UnregisterAppNotRegistered) {
- int rc;
- uuid_t invalid_uuid;
-
- memset(&invalid_uuid, 0x4b, sizeof(uuid_t));
-
- rc = unregister_app(&invalid_uuid);
- EXPECT_EQ(ERR_NOT_FOUND, rc);
-}
-
-TEST(AppMgmtSyscalls, UnregisterAppInvalidBuiltin) {
- int rc;
-
- rc = unregister_app(&builtin_uuid);
- EXPECT_EQ(ERR_NOT_ALLOWED, rc);
-}
-
-TEST(AppMgmtSyscalls, UnregisterAppInvalidUserAddress) {
- int rc;
-
- rc = unregister_app((uuid_t*)INVALID_USER_ADDRESS);
- EXPECT_EQ(ERR_FAULT, rc);
-}
-
-TEST(AppMgmtSyscalls, UnregisterAppKernelAddress) {
- int rc;
-
- rc = unregister_app((uuid_t*)KERNEL_ADDRESS);
- EXPECT_EQ(ERR_FAULT, rc);
-}
-
-TEST(AppMgmtSyscalls, RegisterAppLoadStart) {
- int rc;
- handle_t chan = INVALID_IPC_HANDLE;
- uevent_t uevt;
- uint32_t img_size;
- uint8_t data = TEST_DATA_BYTE;
- uint8_t recv_data;
-
- /* Register load_start */
- img_size = _bin_load_start_end - _bin_load_start_begin;
- rc = register_app(_bin_load_start_begin, img_size);
- ASSERT_EQ(NO_ERROR, rc);
-
- /* load_start should start after it is registered */
- rc = connect(LOADABLE_PORT, IPC_CONNECT_WAIT_FOR_PORT);
- ASSERT_GE(rc, 0);
-
- /* Send a msg and receive the echo response */
- chan = (handle_t)rc;
- rc = tipc_send1(chan, &data, sizeof(data));
- ASSERT_EQ(sizeof(data), rc);
-
- rc = wait(chan, &uevt, INFINITE_TIME);
- ASSERT_EQ(NO_ERROR, rc);
- ASSERT_NE(0, IPC_HANDLE_POLL_MSG & uevt.event);
-
- rc = tipc_recv1(chan, sizeof(data), &recv_data, sizeof(recv_data));
- ASSERT_EQ(sizeof(data), rc);
- ASSERT_EQ(data, recv_data);
-
- /* load_start should exit after echoing the msg */
-
-test_abort:
- close(chan);
- rc = unregister_app_poll(&load_start_uuid);
- EXPECT_EQ(NO_ERROR, rc);
-}
-
-TEST(AppMgmtSyscalls, RegisterAppPortStart) {
- int rc;
- uevent_t uevt;
- handle_t chan = INVALID_IPC_HANDLE;
- uint32_t img_size;
- uint8_t data = TEST_DATA_BYTE;
- uint8_t recv_data;
-
- /* Register port_start */
- img_size = _bin_port_start_end - _bin_port_start_begin;
- rc = register_app(_bin_port_start_begin, img_size);
- ASSERT_EQ(NO_ERROR, rc);
-
- /* Start and connect to port_start */
- rc = connect(LOADABLE_START_PORT, 0);
- ASSERT_GE(rc, 0);
- chan = (handle_t)rc;
-
- /* Send a msg and receive the echo response */
- rc = tipc_send1(chan, &data, sizeof(data));
- ASSERT_EQ(sizeof(data), rc);
-
- rc = wait(chan, &uevt, INFINITE_TIME);
- ASSERT_EQ(NO_ERROR, rc);
- ASSERT_NE(0, IPC_HANDLE_POLL_MSG & uevt.event);
-
- rc = tipc_recv1(chan, sizeof(data), &recv_data, sizeof(recv_data));
- ASSERT_EQ(sizeof(data), rc);
- ASSERT_EQ(data, recv_data);
-
- /* port_start should exit after echoing the msg */
-
-test_abort:
- close(chan);
- rc = unregister_app_poll(&port_start_uuid);
- EXPECT_EQ(NO_ERROR, rc);
- return;
-}
-
-TEST(AppMgmtSyscalls, RegisterAppPortStartWaitingConnection) {
- int rc;
- uevent_t uevt;
- handle_t chan = INVALID_IPC_HANDLE;
- uint32_t img_size;
- uint8_t data = TEST_DATA_BYTE;
- uint8_t recv_data;
-
- /*
- * Create a connection that is waiting for a port registered by an app
- * that will be loaded (i.e. port_start).
- */
- rc = connect(LOADABLE_START_PORT,
- IPC_CONNECT_ASYNC | IPC_CONNECT_WAIT_FOR_PORT);
- ASSERT_GE(rc, 0);
- chan = (handle_t)rc;
-
- /* Register port_start */
- img_size = _bin_port_start_end - _bin_port_start_begin;
- rc = register_app(_bin_port_start_begin, img_size);
- ASSERT_EQ(NO_ERROR, rc);
-
- /*
- * The app should be started by the waiting connectiong. Wait for the
- * connection to stablish
- */
- rc = wait(chan, &uevt, INFINITE_TIME);
- ASSERT_EQ(NO_ERROR, rc);
- ASSERT_NE(0, IPC_HANDLE_POLL_READY & uevt.event);
-
- /* Send a msg and receive the echo response */
- rc = tipc_send1(chan, &data, sizeof(data));
- ASSERT_EQ(sizeof(data), rc);
-
- rc = wait(chan, &uevt, INFINITE_TIME);
- ASSERT_EQ(NO_ERROR, rc);
- ASSERT_NE(0, IPC_HANDLE_POLL_MSG & uevt.event);
-
- rc = tipc_recv1(chan, sizeof(data), &recv_data, sizeof(recv_data));
- ASSERT_EQ(sizeof(data), rc);
- ASSERT_EQ(data, recv_data);
-
- /* port_start should exit after echoing the msg */
-
-test_abort:
- close(chan);
- rc = unregister_app_poll(&port_start_uuid);
- EXPECT_EQ(NO_ERROR, rc);
- return;
-}
-
-TEST(AppMgmtSyscalls, RegisterAppAlreadyExists) {
- int rc;
- uint32_t img_size;
-
- /* Register port_start */
- img_size = _bin_port_start_end - _bin_port_start_begin;
- rc = register_app(_bin_port_start_begin, img_size);
- ASSERT_EQ(NO_ERROR, rc);
-
- /* Try to register port_start again */
- rc = register_app(_bin_port_start_begin, img_size);
- ASSERT_EQ(ERR_ALREADY_EXISTS, rc);
-
-test_abort:
- rc = unregister_app_poll(&port_start_uuid);
- EXPECT_EQ(NO_ERROR, rc);
- return;
-}
-
-TEST(AppMgmtSyscalls, RegisterAppPortAlreadyExists) {
- int rc;
- uint32_t img_size;
-
- /* Register port_start */
- img_size = _bin_port_start_end - _bin_port_start_begin;
- rc = register_app(_bin_port_start_begin, img_size);
- ASSERT_EQ(NO_ERROR, rc);
-
- /*
- * Try to register duplicate port. This should fail as duplicate_port tries
- * to register a port (LOADABLE_START_PORT) that is already registered by
- * port_start.
- */
- img_size = _bin_duplicate_port_end - _bin_duplicate_port_begin;
- rc = register_app(_bin_duplicate_port_begin, img_size);
- ASSERT_EQ(ERR_ALREADY_EXISTS, rc);
-
-test_abort:
- rc = unregister_app_poll(&port_start_uuid);
- EXPECT_EQ(NO_ERROR, rc);
- return;
-}
-
-TEST(AppMgmtSyscalls, UnregisterAppRunning) {
- int rc;
- uevent_t uevt;
- handle_t chan = INVALID_IPC_HANDLE;
- uint32_t img_size;
- uint8_t data = TEST_DATA_BYTE;
- uint8_t recv_data;
-
- /* Register port_start */
- img_size = _bin_port_start_end - _bin_port_start_begin;
- rc = register_app(_bin_port_start_begin, img_size);
- ASSERT_EQ(NO_ERROR, rc);
-
- /* Start the app by connecting to it */
- rc = connect(LOADABLE_START_PORT, IPC_CONNECT_WAIT_FOR_PORT);
- ASSERT_GE(rc, 0);
- chan = (handle_t)rc;
-
- /* Try to unregister the app while it is sitll running */
- rc = unregister_app(&port_start_uuid);
- ASSERT_EQ(ERR_BUSY, rc);
-
- /* Send a msg and receive the echo response */
- rc = tipc_send1(chan, &data, sizeof(data));
- ASSERT_EQ(sizeof(data), rc);
-
- rc = wait(chan, &uevt, INFINITE_TIME);
- ASSERT_EQ(NO_ERROR, rc);
- ASSERT_NE(0, IPC_HANDLE_POLL_MSG & uevt.event);
-
- rc = tipc_recv1(chan, sizeof(data), &recv_data, sizeof(recv_data));
- ASSERT_EQ(sizeof(data), rc);
- ASSERT_EQ(data, recv_data);
-
- /* port_start should exit after echoing the msg */
-
-test_abort:
- /* Unregister port_start */
- rc = unregister_app_poll(&port_start_uuid);
- EXPECT_EQ(NO_ERROR, rc);
- return;
-}
-
-PORT_TEST(AppMgmtSyscalls, PORT_BASE)
diff --git a/app-mgmt-test/syscalls-test/main/manifest.c b/app-mgmt-test/syscalls-test/main/manifest.c
deleted file mode 100644
index 16d86d5..0000000
--- a/app-mgmt-test/syscalls-test/main/manifest.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <trusty_app_manifest.h>
-
-trusty_app_manifest_t TRUSTY_APP_MANIFEST_ATTRS trusty_app_manifest = {
- /* UUID : {c51f3873-7aec-447d-96ef-a59792571b17} */
- {0xc51f3873,
- 0x7aec,
- 0x447d,
- {0x96, 0xef, 0xa5, 0x97, 0x92, 0x57, 0x1b, 0x17}},
-
- /* optional configuration options here */
- {
- TRUSTY_APP_CONFIG_MIN_HEAP_SIZE(1 * 4096),
- TRUSTY_APP_CONFIG_MIN_STACK_SIZE(3 * 4096),
- },
-};
diff --git a/app-mgmt-test/syscalls-test/main/rules.mk b/app-mgmt-test/syscalls-test/main/rules.mk
deleted file mode 100644
index c9493f3..0000000
--- a/app-mgmt-test/syscalls-test/main/rules.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (C) 2019 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_DIR := $(GET_LOCAL_DIR)
-
-MODULE := $(LOCAL_DIR)
-
-MODULE_INCLUDES +=\
- $(LOCAL_DIR)/../../include \
-
-MODULE_SRCS += \
- $(LOCAL_DIR)/appobj.S \
- $(LOCAL_DIR)/main.c \
- $(LOCAL_DIR)/manifest.c \
-
-MODULE_DEPS += \
- trusty/user/base/lib/libc-trusty \
- trusty/user/base/lib/tipc \
- trusty/user/base/lib/unittest \
-
-TEST_APPS_DIR := test_apps
-TEST_APPS := \
- duplicate_port \
- load_start \
- port_start \
-
-
-TEST_APPS_ELFS = $(foreach TEST_APP, $(TEST_APPS), \
- $(call TOBUILDDIR, $(TEST_APPS_DIR)/$(TEST_APP)/$(TEST_APP).elf))
-
-MODULE_SRCDEPS += $(TEST_APPS_ELFS)
-
-MODULE_ASMFLAGS += $(foreach TEST_ELF, $(TEST_APPS_ELFS), \
- -DFILE_NAME_$(notdir $(basename $(TEST_ELF)))=$(TEST_ELF))
-
-include make/module.mk
diff --git a/app-mgmt-test/syscalls-test/main/test_apps/duplicate_port/main.c b/app-mgmt-test/syscalls-test/main/test_apps/duplicate_port/main.c
deleted file mode 100644
index 6a98fad..0000000
--- a/app-mgmt-test/syscalls-test/main/test_apps/duplicate_port/main.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <app_mgmt_test.h>
-#include <trusty_log.h>
-
-#define TLOG_TAG "duplicate-port"
-
-int main(void) {
- TLOGE("Running app that should never start\n");
- TLOGE("Port %s should have already been registered\n", LOADABLE_START_PORT);
- return -1;
-}
diff --git a/app-mgmt-test/syscalls-test/main/test_apps/duplicate_port/manifest.c b/app-mgmt-test/syscalls-test/main/test_apps/duplicate_port/manifest.c
deleted file mode 100644
index f3546d0..0000000
--- a/app-mgmt-test/syscalls-test/main/test_apps/duplicate_port/manifest.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <app_mgmt_test.h>
-#include <trusty_app_manifest.h>
-
-trusty_app_manifest_t TRUSTY_APP_MANIFEST_ATTRS trusty_app_manifest = {
- /* UUID : {038a9b0d-13af-4cf8-9907-5fa150e94225} */
- {0x038a9b0d,
- 0x13af,
- 0x4cf8,
- {0x99, 0x07, 0x5f, 0xa1, 0x50, 0xe9, 0x42, 0x25}},
-
- /* optional configuration options here */
- {
- TRUSTY_APP_CONFIG_MIN_HEAP_SIZE(1 * 4096),
- },
-};
-
-TRUSTY_APP_START_PORT(LOADABLE_START_PORT, IPC_PORT_ALLOW_TA_CONNECT);
diff --git a/app-mgmt-test/syscalls-test/main/test_apps/duplicate_port/rules.mk b/app-mgmt-test/syscalls-test/main/test_apps/duplicate_port/rules.mk
deleted file mode 100644
index f4f1099..0000000
--- a/app-mgmt-test/syscalls-test/main/test_apps/duplicate_port/rules.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2019 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_DIR := $(GET_LOCAL_DIR)
-
-MODULE := $(LOCAL_DIR)
-
-MODULE_INCLUDES += \
- $(LOCAL_DIR)/../../../../include \
-
-MODULE_SRCS += \
- $(LOCAL_DIR)/main.c \
- $(LOCAL_DIR)/manifest.c
-
-MODULE_DEPS += \
- trusty/user/base/lib/libc-trusty \
- trusty/user/base/lib/tipc \
-
-include make/module.mk
diff --git a/app-mgmt-test/syscalls-test/main/test_apps/load_start/main.c b/app-mgmt-test/syscalls-test/main/test_apps/load_start/main.c
deleted file mode 100644
index 426a6a5..0000000
--- a/app-mgmt-test/syscalls-test/main/test_apps/load_start/main.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <app_mgmt_test.h>
-#include <lib/tipc/tipc.h>
-#include <stdio.h>
-#include <trusty_ipc.h>
-#include <uapi/err.h>
-
-#define TLOG_TAG "load-start"
-
-int main(void) {
- int rc;
- uint8_t data;
- int data_len;
- handle_t port;
- handle_t chan;
- uevent_t uevt;
- uuid_t peer_uuid;
-
- data_len = sizeof(data);
-
- rc = port_create(LOADABLE_PORT, 1, 1, IPC_PORT_ALLOW_TA_CONNECT);
- if (rc < 0) {
- TLOGI("Failed (%d) to create port: %s\n", rc, LOADABLE_PORT);
- return rc;
- }
-
- port = (handle_t)rc;
-
- rc = wait(port, &uevt, INFINITE_TIME);
- if (rc != NO_ERROR || !(uevt.event & IPC_HANDLE_POLL_READY)) {
- TLOGI("Port wait failed: %d(%d)\n", rc, uevt.event);
- goto err_port_wait;
- }
-
- rc = accept(uevt.handle, &peer_uuid);
- if (rc < 0) {
- TLOGI("Accept failed %d\n", rc);
- goto err_accept;
- }
-
- chan = (handle_t)rc;
- rc = wait(chan, &uevt, INFINITE_TIME);
- if (rc < 0 || !(uevt.event & IPC_HANDLE_POLL_MSG)) {
- TLOGI("Channel wait failed: %d(%d)\n", rc, uevt.event);
- goto err_chan_wait;
- }
-
- rc = tipc_recv1(chan, data_len, &data, data_len);
- if (rc < data_len) {
- TLOGI("receive failed: %d\n", rc);
- goto err_recv;
- }
-
- rc = tipc_send1(chan, &data, data_len);
- if (rc < data_len) {
- TLOGI("send failed: %d\n", rc);
- goto err_send;
- }
-
- rc = 0;
-
-err_send:
-err_recv:
-err_chan_wait:
- close(chan);
-err_accept:
-err_port_wait:
- close(port);
- return rc;
-}
diff --git a/app-mgmt-test/syscalls-test/main/test_apps/load_start/manifest.c b/app-mgmt-test/syscalls-test/main/test_apps/load_start/manifest.c
deleted file mode 100644
index 40ff095..0000000
--- a/app-mgmt-test/syscalls-test/main/test_apps/load_start/manifest.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <app_mgmt_test.h>
-#include <trusty_app_manifest.h>
-
-trusty_app_manifest_t TRUSTY_APP_MANIFEST_ATTRS trusty_app_manifest = {
- /* UUID : {979f88fb-2928-4295-b274-97595ab5349e} */
- .uuid = LOAD_START_UUID,
- /* optional configuration options here */
- {
- TRUSTY_APP_CONFIG_MIN_HEAP_SIZE(1 * 4096),
- },
-};
diff --git a/app-mgmt-test/syscalls-test/main/test_apps/load_start/rules.mk b/app-mgmt-test/syscalls-test/main/test_apps/load_start/rules.mk
deleted file mode 100644
index f4f1099..0000000
--- a/app-mgmt-test/syscalls-test/main/test_apps/load_start/rules.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2019 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_DIR := $(GET_LOCAL_DIR)
-
-MODULE := $(LOCAL_DIR)
-
-MODULE_INCLUDES += \
- $(LOCAL_DIR)/../../../../include \
-
-MODULE_SRCS += \
- $(LOCAL_DIR)/main.c \
- $(LOCAL_DIR)/manifest.c
-
-MODULE_DEPS += \
- trusty/user/base/lib/libc-trusty \
- trusty/user/base/lib/tipc \
-
-include make/module.mk
diff --git a/app-mgmt-test/syscalls-test/main/test_apps/port_start/main.c b/app-mgmt-test/syscalls-test/main/test_apps/port_start/main.c
deleted file mode 100644
index 5996e69..0000000
--- a/app-mgmt-test/syscalls-test/main/test_apps/port_start/main.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <app_mgmt_test.h>
-#include <lib/tipc/tipc.h>
-#include <stdio.h>
-#include <trusty_ipc.h>
-#include <uapi/err.h>
-
-#define TLOG_TAG "load-port-start"
-
-int main(void) {
- int rc;
- handle_t start_port;
- handle_t chan;
- uevent_t uevt;
- uuid_t peer_uuid;
- uint8_t data;
- int data_len;
-
- data_len = sizeof(data);
-
- rc = port_create(LOADABLE_START_PORT, 1, 1, IPC_PORT_ALLOW_TA_CONNECT);
- if (rc < 0) {
- TLOGI("failed (%d) to create port: %s\n", rc, LOADABLE_START_PORT);
- return rc;
- }
- start_port = (handle_t)rc;
-
- rc = wait(start_port, &uevt, INFINITE_TIME);
- if (rc != NO_ERROR || !(uevt.event & IPC_HANDLE_POLL_READY)) {
- TLOGI("Port wait failed: %d(%d)\n", rc, uevt.event);
- goto err_port_wait;
- }
-
- rc = accept(uevt.handle, &peer_uuid);
- if (rc < 0) {
- TLOGI("Accept failed %d\n", rc);
- goto err_accept;
- }
-
- chan = (handle_t)rc;
- rc = wait(chan, &uevt, INFINITE_TIME);
- if (rc < 0 || !(uevt.event & IPC_HANDLE_POLL_MSG)) {
- TLOGI("Channel wait failed: %d(%d)\n", rc, uevt.event);
- goto err_chan_wait;
- }
-
- rc = tipc_recv1(chan, data_len, &data, data_len);
- if (rc < data_len) {
- TLOG("Receive failed: %d\n", rc);
- goto err_recv;
- }
-
- rc = tipc_send1(chan, &data, data_len);
- if (rc < data_len) {
- TLOGI("Send failed: %d\n", rc);
- goto err_send;
- }
-
- rc = 0;
-
-err_send:
-err_recv:
-err_chan_wait:
- close(chan);
-err_accept:
-err_port_wait:
- close(start_port);
- return rc;
-}
diff --git a/app-mgmt-test/syscalls-test/main/test_apps/port_start/manifest.c b/app-mgmt-test/syscalls-test/main/test_apps/port_start/manifest.c
deleted file mode 100644
index 536713e..0000000
--- a/app-mgmt-test/syscalls-test/main/test_apps/port_start/manifest.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <app_mgmt_test.h>
-#include <trusty_app_manifest.h>
-
-trusty_app_manifest_t TRUSTY_APP_MANIFEST_ATTRS trusty_app_manifest = {
- /* UUID : {c14672f9-6a19-4e3e-9b27-0cd6024de401} */
- .uuid = PORT_START_UUID,
- /* optional configuration options here */
- {
- TRUSTY_APP_CONFIG_MIN_HEAP_SIZE(1 * 4096),
- TRUSTY_APP_CONFIG_MGMT_FLAGS(
- TRUSTY_APP_MGMT_FLAGS_DEFERRED_START),
- },
-};
-
-TRUSTY_APP_START_PORT(LOADABLE_START_PORT, IPC_PORT_ALLOW_TA_CONNECT);
diff --git a/app-mgmt-test/syscalls-test/main/test_apps/port_start/rules.mk b/app-mgmt-test/syscalls-test/main/test_apps/port_start/rules.mk
deleted file mode 100644
index f4f1099..0000000
--- a/app-mgmt-test/syscalls-test/main/test_apps/port_start/rules.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2019 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_DIR := $(GET_LOCAL_DIR)
-
-MODULE := $(LOCAL_DIR)
-
-MODULE_INCLUDES += \
- $(LOCAL_DIR)/../../../../include \
-
-MODULE_SRCS += \
- $(LOCAL_DIR)/main.c \
- $(LOCAL_DIR)/manifest.c
-
-MODULE_DEPS += \
- trusty/user/base/lib/libc-trusty \
- trusty/user/base/lib/tipc \
-
-include make/module.mk
diff --git a/build-config-usertests b/build-config-usertests
index ee3e0fd..5c2d445 100644
--- a/build-config-usertests
+++ b/build-config-usertests
@@ -17,8 +17,6 @@
[
# userspace tests that don't use storage
porttest("com.android.appmgmt-unittest.appmngr"),
- porttest("com.android.appmgmt-unittest.syscalls"),
- porttest("com.android.appmgmt-unittest.syscalls.aux"),
porttest("com.android.ipc-unittest.ctrl"),
porttest("com.android.libctest"),
porttest("com.android.libcxxtest"),
diff --git a/usertests-inc.mk b/usertests-inc.mk
index 0eaed13..a168746 100644
--- a/usertests-inc.mk
+++ b/usertests-inc.mk
@@ -19,9 +19,6 @@
trusty/user/app/sample/app-mgmt-test/never-start-srv \
trusty/user/app/sample/app-mgmt-test/port-start-srv \
trusty/user/app/sample/app-mgmt-test/restart-srv \
- trusty/user/app/sample/app-mgmt-test/syscalls-test/aux \
- trusty/user/app/sample/app-mgmt-test/syscalls-test/builtin \
- trusty/user/app/sample/app-mgmt-test/syscalls-test/main \
trusty/user/app/sample/hwcrypto-unittest \
trusty/user/app/sample/ipc-unittest/main \
trusty/user/app/sample/ipc-unittest/srv \
@@ -35,7 +32,3 @@
trusty/user/app/sample/uirq-unittest \
TRUSTY_LOADABLE_USER_TASKS += \
- trusty/user/app/sample/app-mgmt-test/syscalls-test/main/test_apps/duplicate_port \
- trusty/user/app/sample/app-mgmt-test/syscalls-test/main/test_apps/load_start \
- trusty/user/app/sample/app-mgmt-test/syscalls-test/main/test_apps/port_start \
-