Skip to content

Commit

Permalink
shell lib: Add example how to run C child
Browse files Browse the repository at this point in the history
Signed-off-by: Cyril Hrubis <[email protected]>
Reviewed-by: Petr Vorel <[email protected]>
Tested-by: Petr Vorel <[email protected]>
  • Loading branch information
metan-ucw committed Nov 13, 2024
1 parent a572127 commit 762ee52
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion testcases/lib/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ for i in shell_loader.sh shell_loader_all_filesystems.sh shell_loader_no_metadat
shell_loader_wrong_metadata.sh shell_loader_invalid_metadata.sh\
shell_loader_supported_archs.sh shell_loader_filesystems.sh\
shell_loader_tcnt.sh shell_loader_kconfigs.sh shell_loader_tags.sh \
shell_loader_invalid_block.sh; do
shell_loader_invalid_block.sh shell_loader_c_child.sh; do
echo
echo "*** Running $i ***"
echo
Expand Down
1 change: 1 addition & 0 deletions testcases/lib/tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ shell_test03
shell_test04
shell_test05
shell_test06
shell_c_child
16 changes: 16 additions & 0 deletions testcases/lib/tests/shell_c_child.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Shell test C child example.
*/

#define TST_NO_DEFAULT_MAIN
#include "tst_test.h"

int main(void)
{
tst_reinit();

tst_res(TPASS, "C child works fine!");

return 0;
}
24 changes: 24 additions & 0 deletions testcases/lib/tests/shell_loader_c_child.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
#
# ---
# doc
#
# [Description]
#
# This is an example how to run C child from shell.
# ---
#
# ---
# env
# {
# }
# ---

. tst_loader.sh

if [ -n "LTP_IPC_PATH" ]; then
tst_res TPASS "LTP_IPC_PATH=$LTP_IPC_PATH!"
fi

tst_res TINFO "Running C child"
shell_c_child

0 comments on commit 762ee52

Please sign in to comment.