From: Mark Hatle <mark.hatle@kernel.crashing.org>
To: yocto-patches@lists.yoctoproject.org
Cc: richard.purdie@linuxfoundation.org, frezidok1@gmail.com
Subject: [pseudo][PATCH v2 23/23] test: various: Move to makefile compilation
Date: Fri, 3 Jul 2026 13:40:55 -0500 [thread overview]
Message-ID: <1783104055-19005-24-git-send-email-mark.hatle@kernel.crashing.org> (raw)
In-Reply-To: <1783104055-19005-1-git-send-email-mark.hatle@kernel.crashing.org>
From: Mark Hatle <mark.hatle@amd.com>
Removal local gcc call from test environment, the makefile is more suited
to building the tests. This ensures they can be built properly in a cross
compile environment.
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
---
test/test-chroot.c | 10 ++++++++++
test/test-chroot.sh | 14 +-------------
test/test-execl.c | 4 ++++
test/test-execl.sh | 13 +------------
test/test-linkat-chroot.sh | 4 +---
test/test-reexec-chroot.c | 10 ++++++++++
test/test-reexec-chroot.sh | 14 +-------------
7 files changed, 28 insertions(+), 41 deletions(-)
create mode 100644 test/test-chroot.c
create mode 100644 test/test-execl.c
create mode 100644 test/test-reexec-chroot.c
diff --git a/test/test-chroot.c b/test/test-chroot.c
new file mode 100644
index 0000000..7b18946
--- /dev/null
+++ b/test/test-chroot.c
@@ -0,0 +1,10 @@
+/* Return vals: 2 - invalid arg list
+ * 1 - chroot failed
+ * 0 - chroot succeeded
+ */
+#include <unistd.h>
+int main(int argc, char *argv[]) {
+ if (argc != 2)
+ return 2;
+ return (chroot(argv[1]) == -1);
+}
diff --git a/test/test-chroot.sh b/test/test-chroot.sh
index faa4ffe..a7778ba 100755
--- a/test/test-chroot.sh
+++ b/test/test-chroot.sh
@@ -6,25 +6,13 @@
# Return vals: 2 - invalid arg list
# 1 - chroot failed
# 0 - chroot succeeded
-cat > chroot_test.c << EOF
-#include <unistd.h>
-int main(int argc, char *argv[]) {
- if (argc != 2)
- return 2;
- return (chroot(argv[1]) == -1);
-}
-EOF
-gcc -o chroot_test chroot_test.c
-
-./chroot_test `pwd`
+$(dirname "$0")/test-chroot `pwd`
if [ "$?" = "0" ]
then
#echo "Passed."
- rm -f chroot_test chroot_test.c
exit 0
fi
#echo "Failed"
-rm -f chroot_test chroot_test.c
exit 1
diff --git a/test/test-execl.c b/test/test-execl.c
new file mode 100644
index 0000000..31b803c
--- /dev/null
+++ b/test/test-execl.c
@@ -0,0 +1,4 @@
+#include <unistd.h>
+int main() {
+ return execl("/usr/bin/env", "/usr/bin/env", "A=A", "B=B", "C=C", NULL);
+}
diff --git a/test/test-execl.sh b/test/test-execl.sh
index 134055b..8715822 100755
--- a/test/test-execl.sh
+++ b/test/test-execl.sh
@@ -2,23 +2,12 @@
#
# SPDX-License-Identifier: LGPL-2.1-only
#
-cat > execl_test.c << EOF
-#include <unistd.h>
-int main() {
- return execl("/usr/bin/env", "/usr/bin/env", "A=A", "B=B", "C=C", NULL);
-}
-EOF
-
-gcc -o execl_test execl_test.c
-
-./execl_test | grep -q "C=C"
+$(dirname "$0")/test-execl | grep -q "C=C"
if [ "$?" = "0" ]
then
#echo "Passed."
- rm -f execl_test execl_test.c
exit 0
fi
#echo "Failed"
-rm -f execl_test execl_test.c
exit 1
diff --git a/test/test-linkat-chroot.sh b/test/test-linkat-chroot.sh
index 247a6d7..4f990c7 100755
--- a/test/test-linkat-chroot.sh
+++ b/test/test-linkat-chroot.sh
@@ -14,6 +14,4 @@ mkdir -p "$CHROOTDIR"
touch "$CHROOTDIR/a"
trap "rm -rf $(pwd)/linkat_chroot_test test-linkat-chroot" 0
-gcc -o test-linkat-chroot test/test-linkat-chroot.c
-
-./test-linkat-chroot "$CHROOTDIR"
+$(dirname "$0")/test-linkat-chroot "$CHROOTDIR"
diff --git a/test/test-reexec-chroot.c b/test/test-reexec-chroot.c
new file mode 100644
index 0000000..7b18946
--- /dev/null
+++ b/test/test-reexec-chroot.c
@@ -0,0 +1,10 @@
+/* Return vals: 2 - invalid arg list
+ * 1 - chroot failed
+ * 0 - chroot succeeded
+ */
+#include <unistd.h>
+int main(int argc, char *argv[]) {
+ if (argc != 2)
+ return 2;
+ return (chroot(argv[1]) == -1);
+}
diff --git a/test/test-reexec-chroot.sh b/test/test-reexec-chroot.sh
index f6412bc..0666caf 100755
--- a/test/test-reexec-chroot.sh
+++ b/test/test-reexec-chroot.sh
@@ -8,26 +8,14 @@
# Return vals: 2 - invalid arg list
# 1 - chroot failed
# 0 - chroot succeeded
-cat > chroot_test.c << EOF
-#include <unistd.h>
-int main(int argc, char *argv[]) {
- if (argc != 2)
- return 2;
- return (chroot(argv[1]) == -1);
-}
-EOF
-
-gcc -o chroot_test chroot_test.c
# The following should just run chroot_test since pseudo is already loaded
-./bin/pseudo ./chroot_test `pwd`
+./bin/pseudo $(dirname "$0")/test-reexec-chroot `pwd`
if [ "$?" = "0" ]
then
#echo "Passed."
- rm -f chroot_test chroot_test.c
exit 0
fi
#echo "Failed"
-rm -f chroot_test chroot_test.c
exit 1
--
1.8.3.1
prev parent reply other threads:[~2026-07-03 18:41 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 18:40 [pseudo][PATCH v2 00/23] Create new pseudo 1.99.0 version Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 01/23] Makefile.in: Move version to 1.99.0 to prep for 2.0 development Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 02/23] pseudo_util: Add log severity flags Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 03/23] pseudo: Add new logging macros Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 04/23] pseudo_util: Change pseudo_diag() calls to appropriate " Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 05/23] pseudo_db: Change pseudo_diag() calls to appropriate macros Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 06/23] pseudo_client: " Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 07/23] pseudo_server: " Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 08/23] pseudo.c: " Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 09/23] pseudolog.c: " Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 10/23] wrappers: " Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 11/23] pseudo: Change pseudo_diag() name to pseudo_log() Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 12/23] pseudo_util: Add default log severity values Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 13/23] pseudo_util.c: strchr now returns const char Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 14/23] test/test-openat2-func.c: Remove unusuaed saved_errno Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 15/23] pseudo.h: Avoid accessing unallocated memory Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 16/23] pseudo_util: Avoid accidental free calls for without_libpseudo() Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 17/23] pseudo_util: Ensure pseudo_setupenvp handles memory consistently Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 18/23] pseudo_util: Avoid a memory leak in pseudo_dropenv() Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 19/23] pseudo_util: Clean up memory handling for setupenvp results Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 20/23] exec*: Replace bash workaround to avoid memory corruption Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 21/23] pseudo_util: Correctly free memory allocated by pseudo_setupenvp Mark Hatle
2026-07-03 18:40 ` [pseudo][PATCH v2 22/23] test-bash-exec-env: Add bash env test case Mark Hatle
2026-07-03 18:40 ` Mark Hatle [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1783104055-19005-24-git-send-email-mark.hatle@kernel.crashing.org \
--to=mark.hatle@kernel.crashing.org \
--cc=frezidok1@gmail.com \
--cc=richard.purdie@linuxfoundation.org \
--cc=yocto-patches@lists.yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).