Skip to content

Commit

Permalink
Merge pull request #985 from jphickey/fix-983-handler-filenames
Browse files Browse the repository at this point in the history
Fix #983, rename hooks to handlers
  • Loading branch information
astrogeco authored May 12, 2021
2 parents 9756b03 + 1a42cdb commit ad0b5db
Show file tree
Hide file tree
Showing 26 changed files with 32 additions and 32 deletions.
12 changes: 6 additions & 6 deletions src/unit-test-coverage/ut-stubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
38 changes: 19 additions & 19 deletions src/ut-stubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions ut_assert/scripts/generate_stubs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
Expand All @@ -78,7 +78,7 @@

my %options = (
"stub-suffix" => 'stubs',
"hook-suffix" => 'hooks'
"handler-suffix" => 'handlers'
);

my @hdrlist = grep(/\S/, map {
Expand Down Expand Up @@ -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_";
Expand All @@ -282,13 +282,13 @@
$handler_func->{$funcname} = $handler_prefix.$funcname;
}
} elsif (!$options{"no-handler"}) {
if (open(HOOK, $hookfile)) {
while (<HOOK>) {
if (open(HANDLER, $handlerfile)) {
while (<HANDLER>) {
if (/void\s+$handler_prefix(\S+)\s*\(/) {
$handler_func->{$1} = $handler_prefix.$1;
}
}
close(HOOK);
close(HANDLER);
}
}

Expand Down

0 comments on commit ad0b5db

Please sign in to comment.