diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..6260ce5 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: 2023-2025 Sony Semiconductor Solutions Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +# All files +* @JSeimizu @MasayaKabuto @oka-r @ShinsukeTashiro + diff --git a/.github/workflows/build-sdk.yml b/.github/workflows/build-sdk.yml index 35445a5..c48a491 100644 --- a/.github/workflows/build-sdk.yml +++ b/.github/workflows/build-sdk.yml @@ -35,13 +35,13 @@ jobs: matrix: include: - name: raspios-bookworm - runner: ${{ github.event.repository.private && 'buildjet-4vcpu-ubuntu-2204-arm' || 'ubuntu-22.04-arm' }} + runner: ubuntu-22.04-4core-arm64 platform: arm64 - name: ubuntu-noble - runner: ${{ github.event.repository.private && 'buildjet-4vcpu-ubuntu-2204-arm' || 'ubuntu-22.04-arm' }} + runner: ubuntu-22.04-4core-arm64 platform: arm64 - name: ubuntu-noble - runner: ${{ github.event.repository.private && 'buildjet-4vcpu-ubuntu-2204' || 'ubuntu-22.04' }} + runner: ubuntu-22.04 platform: amd64 steps: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c66fc4f..949e4a1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,13 +35,13 @@ jobs: matrix: include: - name: raspios-bookworm - runner: ${{ github.event.repository.private && 'buildjet-4vcpu-ubuntu-2204-arm' || 'ubuntu-22.04-arm' }} + runner: ubuntu-22.04-4core-arm64 platform: arm64 - name: ubuntu-noble - runner: ${{ github.event.repository.private && 'buildjet-4vcpu-ubuntu-2204-arm' || 'ubuntu-22.04-arm' }} + runner: ubuntu-22.04-4core-arm64 platform: arm64 - name: ubuntu-noble - runner: ${{ github.event.repository.private && 'buildjet-4vcpu-ubuntu-2204' || 'ubuntu-22.04' }} + runner: ubuntu-22.04 platform: amd64 steps: - name: Checkout source diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml index 21af5a8..1a0f657 100644 --- a/.github/workflows/builder.yml +++ b/.github/workflows/builder.yml @@ -76,7 +76,7 @@ jobs: if: ${{ needs.builder-necessary.outputs.build == 'true' }} needs: - builder-necessary - runs-on: ${{ github.event.repository.private && 'buildjet-8vcpu-ubuntu-2204-arm' || 'ubuntu-22.04-arm' }} + runs-on: ubuntu-22.04-4core-arm64 steps: - name: Checkout the code @@ -111,9 +111,9 @@ jobs: matrix: include: - platform: amd64 - runner: ${{ github.event.repository.private && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-22.04' }} + runner: ubuntu-22.04 - platform: arm64 - runner: ${{ github.event.repository.private && 'buildjet-8vcpu-ubuntu-2204-arm' || 'ubuntu-22.04-arm' }} + runner: ubuntu-22.04-4core-arm64 steps: - name: Checkout the code diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8f81847..e670e01 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,13 +35,13 @@ jobs: matrix: include: - name: raspios-bookworm - runner: ${{ github.event.repository.private && 'buildjet-8vcpu-ubuntu-2204-arm' || 'ubuntu-22.04-arm' }} + runner: ubuntu-22.04-4core-arm64 platform: arm64 - name: ubuntu-noble - runner: ${{ github.event.repository.private && 'buildjet-8vcpu-ubuntu-2204-arm' || 'ubuntu-22.04-arm' }} + runner: ubuntu-22.04-4core-arm64 platform: arm64 - name: ubuntu-noble - runner: ${{ github.event.repository.private && 'buildjet-4vcpu-ubuntu-2204' || 'ubuntu-22.04' }} + runner: ubuntu-22.04 platform: amd64 steps: diff --git a/include/evp/agent.h b/include/evp/agent.h index 1e7b94b..36fc598 100644 --- a/include/evp/agent.h +++ b/include/evp/agent.h @@ -190,6 +190,11 @@ struct evp_agent_notification_blob_result { unsigned int http_status; }; +struct evp_agent_notification_stp_error { + int error; + const char *error_msg; +}; + typedef void (*evp_log_handler_t)(int lvl, const char *file, int line, const char *fmt, va_list ap); diff --git a/scripts/rules.mk b/scripts/rules.mk index 2bbd51e..151ef65 100644 --- a/scripts/rules.mk +++ b/scripts/rules.mk @@ -7,7 +7,7 @@ all: # Macros related to the version of the agent -VERSION = 1.48.1 +VERSION = 1.48.4 SDK_VERSION = 1.0.0 # Default value for configuration macros diff --git a/src/libevp-agent/agent_event.c b/src/libevp-agent/agent_event.c index 9314f54..5e94cc4 100644 --- a/src/libevp-agent/agent_event.c +++ b/src/libevp-agent/agent_event.c @@ -19,6 +19,7 @@ static const char(*const list[]) = { "mqtt/sync/err", "network/error", "start", + "stp/error", "wasm/stopped", }; /* clang-format on */ diff --git a/src/libevp-agent/blob_type_evp_rpc.c b/src/libevp-agent/blob_type_evp_rpc.c index f3ad301..4e1926d 100644 --- a/src/libevp-agent/blob_type_evp_rpc.c +++ b/src/libevp-agent/blob_type_evp_rpc.c @@ -21,6 +21,7 @@ #include "base64.h" #include "blob.h" #include "blob_type_evp.h" +#include "evp/agent.h" #include "hub.h" #include "mstp_schema.h" #include "path.h" @@ -494,6 +495,7 @@ complete_storage_token_request(EVP_RPC_ID id, void *cb_data, void *payload, struct evp_agent_context *agent = args->agent; JSON_Value *json = NULL; struct storagetoken_response resp = {0}; + struct evp_agent_notification_stp_error notification = {0}; xlog_debug( "complete_storage_token_request called for %s, delay=%" PRIu32 @@ -504,6 +506,9 @@ complete_storage_token_request(EVP_RPC_ID id, void *cb_data, void *payload, /* Error completing the request means timeout */ xlog_error("Timeout response: %d. Delay time is %" PRIu32, error, delay); + + notification.error = error; + goto end; } @@ -535,6 +540,10 @@ complete_storage_token_request(EVP_RPC_ID id, void *cb_data, void *payload, error = resp.status; xlog_error("Error from hub: %d (%s). Delay time is %" PRIu32, resp.status, resp.error, delay); + + notification.error = resp.status; + notification.error_msg = resp.error; + goto end; } @@ -552,6 +561,12 @@ complete_storage_token_request(EVP_RPC_ID id, void *cb_data, void *payload, if (error) { notify_done(wk, BLOB_RESULT_ERROR, error); } + + if (notification.error != 0) { + evp_agent_notification_publish(agent, "stp/error", + ¬ification); + } + storagetoken_response_dtor(&resp); json_value_free(json); free(args); diff --git a/src/libevp-agent/evp_hub.c b/src/libevp-agent/evp_hub.c index 05dee04..5840e78 100644 --- a/src/libevp-agent/evp_hub.c +++ b/src/libevp-agent/evp_hub.c @@ -113,12 +113,12 @@ evp_hub_setup(const char *iot_platform) enum evp_hub_type get_hub_type(const char *iot_platform) { - /* Assume EVP1 TB by default, even for invalid 'iot_platform' */ - enum evp_hub_type hub_type = EVP_HUB_TYPE_EVP1_TB; + /* Assume EVP2 TB by default, even for invalid 'iot_platform' */ + enum evp_hub_type hub_type = EVP_HUB_TYPE_EVP2_TB; if (iot_platform != NULL) { - if (strcasecmp(iot_platform, HUB_TB_NAME) == 0) { - hub_type = EVP_HUB_TYPE_EVP2_TB; + if (strcasecmp(iot_platform, HUB_EVP1_NAME) == 0) { + hub_type = EVP_HUB_TYPE_EVP1_TB; } } diff --git a/src/libevp-agent/module_instance_impl_wasm.c b/src/libevp-agent/module_instance_impl_wasm.c index a78e478..a3441ed 100644 --- a/src/libevp-agent/module_instance_impl_wasm.c +++ b/src/libevp-agent/module_instance_impl_wasm.c @@ -58,6 +58,13 @@ #endif #define MAX_EXIT_TIME_IN_SECONDS 5 +#if defined(CONFIG_EVP_MODULE_IMPL_WASM_ENABLE_DNS_ACCESS) +#define POOL_SIZE 1 + +// Network access configuration for WASM modules. +static const char *g_addr_pool[POOL_SIZE] = {"0.0.0.0/0"}; +static const char *g_ns_lookup_pool[POOL_SIZE] = {"*"}; +#endif // CONFIG_EVP_MODULE_IMPL_WASM_ENABLE_DNS_ACCESS static void module_instance_set_status(struct module_instance *m, @@ -298,6 +305,16 @@ setup_fds(struct instance_start *s, const char **workspace, char **error) return ret; } +#if defined(CONFIG_EVP_MODULE_IMPL_WASM_ENABLE_DNS_ACCESS) +static void +setup_network_pools(wasm_module_t wasm_module) +{ + wasm_runtime_set_wasi_addr_pool(wasm_module, g_addr_pool, POOL_SIZE); + wasm_runtime_set_wasi_ns_lookup_pool(wasm_module, g_ns_lookup_pool, + POOL_SIZE); +} +#endif // CONFIG_EVP_MODULE_IMPL_WASM_ENABLE_DNS_ACCESS + static int instantiate(struct instance_start *s, char **error) { @@ -453,6 +470,10 @@ ensure_instance(struct instance_start *s, struct module *mi, return ret; } +#if defined(CONFIG_EVP_MODULE_IMPL_WASM_ENABLE_DNS_ACCESS) + setup_network_pools(s->module); +#endif // CONFIG_EVP_MODULE_IMPL_WASM_ENABLE_DNS_ACCESS + ret = instantiate(s, error); if (ret) { diff --git a/test/src/st-nohub/test_connection_mode.c b/test/src/st-nohub/test_connection_mode.c index a027dde..f3b6ed7 100644 --- a/test/src/st-nohub/test_connection_mode.c +++ b/test/src/st-nohub/test_connection_mode.c @@ -4,7 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include +#include #include #include #include @@ -15,7 +17,6 @@ #include "webclient/webclient.h" -#include "../sync.h" #include "agent_test.h" #include "hub.h" #include "path.h" @@ -31,7 +32,7 @@ #define PROCESS_EVENT_TIMEOUT 3000 struct test { - struct sync_ctxt sync_cons; + sem_t sem; char *filename; }; @@ -44,7 +45,7 @@ __wrap_connections_webclient_perform(FAR struct webclient_context *ctx) { // Sync point with test thread. If enabled, will wait for other // call to `sync_join` from the other thread. - sync_join(&g_test.sync_cons); + assert(!sem_post(&g_test.sem)); return __real_connections_webclient_perform(ctx); } @@ -83,9 +84,6 @@ test_disconnect_reconnect(void **state) .filename = t->filename, }; - // Start blocking blob work - sync_activate(&t->sync_cons, 2); - // test HTTP GET to file struct EVP_BlobRequestHttp request = { .url = TEST_HTTP_GET_URL, @@ -102,7 +100,7 @@ test_disconnect_reconnect(void **state) // Control race condition: wait for blob work to be started and before // http operation is performed. - sync_join(&t->sync_cons); + assert_int_equal(sem_wait(&t->sem), 0); // Expect processed blob to have failed expect_value(blob_cb, reason, EVP_BLOB_CALLBACK_REASON_DONE); @@ -151,7 +149,7 @@ setup(void **state) struct test *t = &g_test; int rv; - rv = sync_init(&t->sync_cons); + rv = sem_init(&t->sem, 0, 0); assert_int_equal(0, rv); agent_test_setup(); rv = systemf("mkdir -p %s", path_get(MODULE_INSTANCE_PATH_ID)); @@ -171,6 +169,9 @@ teardown(void **state) free(t->filename); + if (sem_destroy(&t->sem)) + return -1; + agent_test_exit(); return 0; } diff --git a/version.mk b/version.mk index 0858b37..5fb97eb 100644 --- a/version.mk +++ b/version.mk @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: Apache-2.0 -VERSION = 1.48.1 +VERSION = 1.48.4 COMMIT_HASH = $(shell git describe --always --abbrev=0 --dirty --match "NOT A TAG") define VERSION_BODY