From 1a42cdbed7da9fe16e58c7a0d2a71183921ee816 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 6 May 2021 09:17:43 -0400 Subject: [PATCH] Fix #983, rename hooks to handlers CCB 2021-05-05 review item. Makes filenames better match terms used in implementation. --- .../ut-stubs/CMakeLists.txt | 12 +++--- ...hooks.c => os-shared-file-impl-handlers.c} | 0 ...ks.c => os-shared-filesys-impl-handlers.c} | 0 ...map-hooks.c => os-shared-idmap-handlers.c} | 0 ...ks.c => os-shared-network-impl-handlers.c} | 0 src/ut-stubs/CMakeLists.txt | 38 +++++++++---------- ...binsem-hooks.c => osapi-binsem-handlers.c} | 0 ...i-clock-hooks.c => osapi-clock-handlers.c} | 0 ...tsem-hooks.c => osapi-countsem-handlers.c} | 0 ...osapi-dir-hooks.c => osapi-dir-handlers.c} | 0 ...i-error-hooks.c => osapi-error-handlers.c} | 0 ...api-file-hooks.c => osapi-file-handlers.c} | 0 ...lesys-hooks.c => osapi-filesys-handlers.c} | 0 ...api-heap-hooks.c => osapi-heap-handlers.c} | 0 ...i-idmap-hooks.c => osapi-idmap-handlers.c} | 0 ...module-hooks.c => osapi-module-handlers.c} | 0 ...i-mutex-hooks.c => osapi-mutex-handlers.c} | 0 ...twork-hooks.c => osapi-network-handlers.c} | 0 ...printf-hooks.c => osapi-printf-handlers.c} | 0 ...i-queue-hooks.c => osapi-queue-handlers.c} | 0 ...ckets-hooks.c => osapi-sockets-handlers.c} | 0 ...api-task-hooks.c => osapi-task-handlers.c} | 0 ...base-hooks.c => osapi-timebase-handlers.c} | 0 ...i-timer-hooks.c => osapi-timer-handlers.c} | 0 ...rsion-hooks.c => osapi-version-handlers.c} | 0 ut_assert/scripts/generate_stubs.pl | 14 +++---- 26 files changed, 32 insertions(+), 32 deletions(-) rename src/unit-test-coverage/ut-stubs/src/{os-shared-file-impl-hooks.c => os-shared-file-impl-handlers.c} (100%) rename src/unit-test-coverage/ut-stubs/src/{os-shared-filesys-impl-hooks.c => os-shared-filesys-impl-handlers.c} (100%) rename src/unit-test-coverage/ut-stubs/src/{os-shared-idmap-hooks.c => os-shared-idmap-handlers.c} (100%) rename src/unit-test-coverage/ut-stubs/src/{os-shared-network-impl-hooks.c => os-shared-network-impl-handlers.c} (100%) rename src/ut-stubs/{osapi-binsem-hooks.c => osapi-binsem-handlers.c} (100%) rename src/ut-stubs/{osapi-clock-hooks.c => osapi-clock-handlers.c} (100%) rename src/ut-stubs/{osapi-countsem-hooks.c => osapi-countsem-handlers.c} (100%) rename src/ut-stubs/{osapi-dir-hooks.c => osapi-dir-handlers.c} (100%) rename src/ut-stubs/{osapi-error-hooks.c => osapi-error-handlers.c} (100%) rename src/ut-stubs/{osapi-file-hooks.c => osapi-file-handlers.c} (100%) rename src/ut-stubs/{osapi-filesys-hooks.c => osapi-filesys-handlers.c} (100%) rename src/ut-stubs/{osapi-heap-hooks.c => osapi-heap-handlers.c} (100%) rename src/ut-stubs/{osapi-idmap-hooks.c => osapi-idmap-handlers.c} (100%) rename src/ut-stubs/{osapi-module-hooks.c => osapi-module-handlers.c} (100%) rename src/ut-stubs/{osapi-mutex-hooks.c => osapi-mutex-handlers.c} (100%) rename src/ut-stubs/{osapi-network-hooks.c => osapi-network-handlers.c} (100%) rename src/ut-stubs/{osapi-printf-hooks.c => osapi-printf-handlers.c} (100%) rename src/ut-stubs/{osapi-queue-hooks.c => osapi-queue-handlers.c} (100%) rename src/ut-stubs/{osapi-sockets-hooks.c => osapi-sockets-handlers.c} (100%) rename src/ut-stubs/{osapi-task-hooks.c => osapi-task-handlers.c} (100%) rename src/ut-stubs/{osapi-timebase-hooks.c => osapi-timebase-handlers.c} (100%) rename src/ut-stubs/{osapi-timer-hooks.c => osapi-timer-handlers.c} (100%) rename src/ut-stubs/{osapi-version-hooks.c => osapi-version-handlers.c} (100%) diff --git a/src/unit-test-coverage/ut-stubs/CMakeLists.txt b/src/unit-test-coverage/ut-stubs/CMakeLists.txt index 82efb42b3..8cadb7f1d 100644 --- a/src/unit-test-coverage/ut-stubs/CMakeLists.txt +++ b/src/unit-test-coverage/ut-stubs/CMakeLists.txt @@ -130,13 +130,13 @@ add_custom_target(generate_osal_coverage_stubs COMMAND ${UT_ASSERT_SOURCE_DIR}/scripts/generate_stubs.pl --filter=/_Impl$/ --stub-suffix=impl-stubs - --hook-suffix=impl-hooks + --handler-suffix=impl-handlers ${CMAKE_CURRENT_SOURCE_DIR}/src ${OSAL_SHARED_IMPL_HEADERS} COMMAND ${UT_ASSERT_SOURCE_DIR}/scripts/generate_stubs.pl --filter=/_Init$/ --stub-suffix=init-stubs - --hook-suffix=init-hooks + --handler-suffix=init-handlers ${CMAKE_CURRENT_SOURCE_DIR}/src ${OSAL_SHARED_IMPL_HEADERS} COMMAND ${UT_ASSERT_SOURCE_DIR}/scripts/generate_stubs.pl @@ -158,15 +158,15 @@ add_library(ut_osapi_impl_stubs STATIC EXCLUDE_FROM_ALL src/os-shared-console-impl-stubs.c src/os-shared-countsem-impl-stubs.c src/os-shared-dir-impl-stubs.c - src/os-shared-file-impl-hooks.c + src/os-shared-file-impl-handlers.c src/os-shared-file-impl-stubs.c - src/os-shared-filesys-impl-hooks.c + src/os-shared-filesys-impl-handlers.c src/os-shared-filesys-impl-stubs.c src/os-shared-heap-impl-stubs.c src/os-shared-idmap-impl-stubs.c src/os-shared-module-impl-stubs.c src/os-shared-mutex-impl-stubs.c - src/os-shared-network-impl-hooks.c + src/os-shared-network-impl-handlers.c src/os-shared-network-impl-stubs.c src/os-shared-printf-impl-stubs.c src/os-shared-queue-impl-stubs.c @@ -210,7 +210,7 @@ add_library(ut_osapi_shared_stubs STATIC EXCLUDE_FROM_ALL src/os-shared-file-stubs.c src/os-shared-filesys-stubs.c src/os-shared-globaldefs-stubs.c - src/os-shared-idmap-hooks.c + src/os-shared-idmap-handlers.c src/os-shared-idmap-stubs.c src/os-shared-module-stubs.c src/os-shared-sockets-stubs.c diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-file-impl-hooks.c b/src/unit-test-coverage/ut-stubs/src/os-shared-file-impl-handlers.c similarity index 100% rename from src/unit-test-coverage/ut-stubs/src/os-shared-file-impl-hooks.c rename to src/unit-test-coverage/ut-stubs/src/os-shared-file-impl-handlers.c diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-filesys-impl-hooks.c b/src/unit-test-coverage/ut-stubs/src/os-shared-filesys-impl-handlers.c similarity index 100% rename from src/unit-test-coverage/ut-stubs/src/os-shared-filesys-impl-hooks.c rename to src/unit-test-coverage/ut-stubs/src/os-shared-filesys-impl-handlers.c diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-idmap-hooks.c b/src/unit-test-coverage/ut-stubs/src/os-shared-idmap-handlers.c similarity index 100% rename from src/unit-test-coverage/ut-stubs/src/os-shared-idmap-hooks.c rename to src/unit-test-coverage/ut-stubs/src/os-shared-idmap-handlers.c diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-network-impl-hooks.c b/src/unit-test-coverage/ut-stubs/src/os-shared-network-impl-handlers.c similarity index 100% rename from src/unit-test-coverage/ut-stubs/src/os-shared-network-impl-hooks.c rename to src/unit-test-coverage/ut-stubs/src/os-shared-network-impl-handlers.c diff --git a/src/ut-stubs/CMakeLists.txt b/src/ut-stubs/CMakeLists.txt index 0e8ea53c8..1fb0104fb 100644 --- a/src/ut-stubs/CMakeLists.txt +++ b/src/ut-stubs/CMakeLists.txt @@ -55,45 +55,45 @@ add_custom_target(generate_osapi_stubs add_library(ut_osapi_stubs STATIC utstub-helpers.c osapi-binsem-stubs.c - osapi-binsem-hooks.c + osapi-binsem-handlers.c osapi-clock-stubs.c - osapi-clock-hooks.c + osapi-clock-handlers.c osapi-common-stubs.c osapi-countsem-stubs.c - osapi-countsem-hooks.c + osapi-countsem-handlers.c osapi-dir-stubs.c - osapi-dir-hooks.c + osapi-dir-handlers.c osapi-error-stubs.c - osapi-error-hooks.c + osapi-error-handlers.c osapi-file-stubs.c - osapi-file-hooks.c + osapi-file-handlers.c osapi-filesys-stubs.c - osapi-filesys-hooks.c + osapi-filesys-handlers.c osapi-heap-stubs.c - osapi-heap-hooks.c + osapi-heap-handlers.c osapi-idmap-stubs.c - osapi-idmap-hooks.c + osapi-idmap-handlers.c osapi-module-stubs.c - osapi-module-hooks.c + osapi-module-handlers.c osapi-mutex-stubs.c - osapi-mutex-hooks.c + osapi-mutex-handlers.c osapi-network-stubs.c - osapi-network-hooks.c + osapi-network-handlers.c osapi-printf-stubs.c - osapi-printf-hooks.c + osapi-printf-handlers.c osapi-queue-stubs.c - osapi-queue-hooks.c + osapi-queue-handlers.c osapi-select-stubs.c osapi-sockets-stubs.c - osapi-sockets-hooks.c + osapi-sockets-handlers.c osapi-task-stubs.c - osapi-task-hooks.c + osapi-task-handlers.c osapi-timer-stubs.c - osapi-timer-hooks.c + osapi-timer-handlers.c osapi-timebase-stubs.c - osapi-timebase-hooks.c + osapi-timebase-handlers.c osapi-version-stubs.c - osapi-version-hooks.c + osapi-version-handlers.c ) # Some of the internal API definitions in stubs are based on diff --git a/src/ut-stubs/osapi-binsem-hooks.c b/src/ut-stubs/osapi-binsem-handlers.c similarity index 100% rename from src/ut-stubs/osapi-binsem-hooks.c rename to src/ut-stubs/osapi-binsem-handlers.c diff --git a/src/ut-stubs/osapi-clock-hooks.c b/src/ut-stubs/osapi-clock-handlers.c similarity index 100% rename from src/ut-stubs/osapi-clock-hooks.c rename to src/ut-stubs/osapi-clock-handlers.c diff --git a/src/ut-stubs/osapi-countsem-hooks.c b/src/ut-stubs/osapi-countsem-handlers.c similarity index 100% rename from src/ut-stubs/osapi-countsem-hooks.c rename to src/ut-stubs/osapi-countsem-handlers.c diff --git a/src/ut-stubs/osapi-dir-hooks.c b/src/ut-stubs/osapi-dir-handlers.c similarity index 100% rename from src/ut-stubs/osapi-dir-hooks.c rename to src/ut-stubs/osapi-dir-handlers.c diff --git a/src/ut-stubs/osapi-error-hooks.c b/src/ut-stubs/osapi-error-handlers.c similarity index 100% rename from src/ut-stubs/osapi-error-hooks.c rename to src/ut-stubs/osapi-error-handlers.c diff --git a/src/ut-stubs/osapi-file-hooks.c b/src/ut-stubs/osapi-file-handlers.c similarity index 100% rename from src/ut-stubs/osapi-file-hooks.c rename to src/ut-stubs/osapi-file-handlers.c diff --git a/src/ut-stubs/osapi-filesys-hooks.c b/src/ut-stubs/osapi-filesys-handlers.c similarity index 100% rename from src/ut-stubs/osapi-filesys-hooks.c rename to src/ut-stubs/osapi-filesys-handlers.c diff --git a/src/ut-stubs/osapi-heap-hooks.c b/src/ut-stubs/osapi-heap-handlers.c similarity index 100% rename from src/ut-stubs/osapi-heap-hooks.c rename to src/ut-stubs/osapi-heap-handlers.c diff --git a/src/ut-stubs/osapi-idmap-hooks.c b/src/ut-stubs/osapi-idmap-handlers.c similarity index 100% rename from src/ut-stubs/osapi-idmap-hooks.c rename to src/ut-stubs/osapi-idmap-handlers.c diff --git a/src/ut-stubs/osapi-module-hooks.c b/src/ut-stubs/osapi-module-handlers.c similarity index 100% rename from src/ut-stubs/osapi-module-hooks.c rename to src/ut-stubs/osapi-module-handlers.c diff --git a/src/ut-stubs/osapi-mutex-hooks.c b/src/ut-stubs/osapi-mutex-handlers.c similarity index 100% rename from src/ut-stubs/osapi-mutex-hooks.c rename to src/ut-stubs/osapi-mutex-handlers.c diff --git a/src/ut-stubs/osapi-network-hooks.c b/src/ut-stubs/osapi-network-handlers.c similarity index 100% rename from src/ut-stubs/osapi-network-hooks.c rename to src/ut-stubs/osapi-network-handlers.c diff --git a/src/ut-stubs/osapi-printf-hooks.c b/src/ut-stubs/osapi-printf-handlers.c similarity index 100% rename from src/ut-stubs/osapi-printf-hooks.c rename to src/ut-stubs/osapi-printf-handlers.c diff --git a/src/ut-stubs/osapi-queue-hooks.c b/src/ut-stubs/osapi-queue-handlers.c similarity index 100% rename from src/ut-stubs/osapi-queue-hooks.c rename to src/ut-stubs/osapi-queue-handlers.c diff --git a/src/ut-stubs/osapi-sockets-hooks.c b/src/ut-stubs/osapi-sockets-handlers.c similarity index 100% rename from src/ut-stubs/osapi-sockets-hooks.c rename to src/ut-stubs/osapi-sockets-handlers.c diff --git a/src/ut-stubs/osapi-task-hooks.c b/src/ut-stubs/osapi-task-handlers.c similarity index 100% rename from src/ut-stubs/osapi-task-hooks.c rename to src/ut-stubs/osapi-task-handlers.c diff --git a/src/ut-stubs/osapi-timebase-hooks.c b/src/ut-stubs/osapi-timebase-handlers.c similarity index 100% rename from src/ut-stubs/osapi-timebase-hooks.c rename to src/ut-stubs/osapi-timebase-handlers.c diff --git a/src/ut-stubs/osapi-timer-hooks.c b/src/ut-stubs/osapi-timer-handlers.c similarity index 100% rename from src/ut-stubs/osapi-timer-hooks.c rename to src/ut-stubs/osapi-timer-handlers.c diff --git a/src/ut-stubs/osapi-version-hooks.c b/src/ut-stubs/osapi-version-handlers.c similarity index 100% rename from src/ut-stubs/osapi-version-hooks.c rename to src/ut-stubs/osapi-version-handlers.c diff --git a/ut_assert/scripts/generate_stubs.pl b/ut_assert/scripts/generate_stubs.pl index 03e3574b1..fefa2623f 100755 --- a/ut_assert/scripts/generate_stubs.pl +++ b/ut_assert/scripts/generate_stubs.pl @@ -47,7 +47,7 @@ # # By default the stubs are written to a file with the same basename and a "-stubs" suffix. # -# This script will check corresponding hook file (via the hook-suffix option) for the presence +# This script will check corresponding handler file (via the handler-suffix option) for the presence # of a handler. A reference to the handler will only be generated in the stub if it exists. # This is a convenience option to avoid rendering references to handlers that do not exist, # while still allowing the set to grow over time. @@ -60,7 +60,7 @@ # (note the result will fail to link unless handler is actually implemented) # --filter: a perl regex expression to apply on function names (e.g. /_Impl$/) # --stub-suffix: a suffix to use for the generated file names ("stubs" by default) -# --hook-suffix: a suffix to use for the generated file names ("hooks" by default) +# --handler-suffix: a suffix to use for the generated file names ("handlers" by default) # use strict; @@ -78,7 +78,7 @@ my %options = ( "stub-suffix" => 'stubs', - "hook-suffix" => 'hooks' + "handler-suffix" => 'handlers' ); my @hdrlist = grep(/\S/, map { @@ -272,7 +272,7 @@ $refname .= '_'; } my $stubfile = $refname . $options{"stub-suffix"} . '.c'; - my $hookfile = $refname . $options{"hook-suffix"} . '.c'; + my $handlerfile = $refname . $options{"handler-suffix"} . '.c'; my $handler_func = {}; my $handler_prefix = "UT_DefaultHandler_"; @@ -282,13 +282,13 @@ $handler_func->{$funcname} = $handler_prefix.$funcname; } } elsif (!$options{"no-handler"}) { - if (open(HOOK, $hookfile)) { - while () { + if (open(HANDLER, $handlerfile)) { + while () { if (/void\s+$handler_prefix(\S+)\s*\(/) { $handler_func->{$1} = $handler_prefix.$1; } } - close(HOOK); + close(HANDLER); } }