Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Commit

Permalink
fix(endpoint): Move endpoint_core unit test into unit-test directory
Browse files Browse the repository at this point in the history
The endpoint_core's unit test needs to create a tangle-accelerator
before testing. After create a tangle-accelerator docker daemon on
buildkite agent for testing, it can be tested automatically.

Update the default port from 443 to 8000 to pass the test on buildkite.

This commit also fixes the double free error inside cipher_logger_release.

Close #669
  • Loading branch information
splasky committed Jun 17, 2020
1 parent 9b00d70 commit 8b84085
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 21 deletions.
15 changes: 1 addition & 14 deletions endpoint/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cc_library(
hdrs = ["endpoint_core.h"],
defines = [
"ENDPOINT_HOST=\"localhost\"",
"ENDPOINT_PORT=\"443\"",
"ENDPOINT_PORT=\"8000\"",
"ENDPOINT_SSL_SEED=\"nonce\"",
],
visibility = ["//visibility:public"],
Expand All @@ -18,19 +18,6 @@ cc_library(
],
)

cc_test(
name = "test_endpoint_core",
srcs = [
"test_endpoint_core.c",
],
deps = [
":endpoint_core",
"//common:ta_errors",
"//common:ta_logger",
"//tests:test_define",
],
)

cc_binary(
name = "libendpoint.so",
srcs = [
Expand Down
13 changes: 13 additions & 0 deletions tests/unit-test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,16 @@ cc_test(
"//utils/connectivity:conn_http",
],
)

cc_test(
name = "test_endpoint_core",
srcs = [
"test_endpoint_core.c",
],
deps = [
"//common:ta_errors",
"//common:ta_logger",
"//endpoint:endpoint_core",
"//tests:test_define",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <stdlib.h>
#include <time.h>
#include "common/ta_errors.h"
#include "endpoint_core.h"
#include "endpoint/endpoint_core.h"
#include "tests/test_define.h"
#include "utils/cipher.h"

Expand Down
7 changes: 1 addition & 6 deletions utils/cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ void cipher_logger_init() { logger_id = logger_helper_enable(CIPHER_LOGGER, LOGG

int cipher_logger_release() {
logger_helper_release(logger_id);
if (logger_helper_destroy() != RC_OK) {
ta_log_error("Destroying logger failed %s.\n", CIPHER_LOGGER);
return EXIT_FAILURE;
}

return 0;
return SC_OK;
}

status_t aes_decrypt(ta_cipher_ctx* cipher_ctx) {
Expand Down

0 comments on commit 8b84085

Please sign in to comment.