From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Cc: John Stultz <jstultz@google.com>,
kernel-team@android.com,
Darren Hart <darren@os.amperecomputing.com>
Subject: [LTP] [PATCH v1] include/tst_timer: Add TST_NO_LIBLTP
Date: Wed, 26 Jun 2024 15:30:04 +0200 [thread overview]
Message-ID: <20240626133004.15810-1-chrubis@suse.cz> (raw)
Older compilers (gcc-4.8) are not smart enough to eliminate the
impossible branch with tst_brk() early enough and the sched_football
compilation fails due to the unresolved function.
Add TST_NO_LIBLTP macro that changes the tst_brk() messages into abort()
and make use of it in sched_football.
Fixes compilation on Leap-42.2.
Cc: kernel-team@android.com
Cc: Darren Hart <darren@os.amperecomputing.com>
Cc: John Stultz <jstultz@google.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
include/tst_timer.h | 16 ++++++++++++++++
| 1 +
2 files changed, 17 insertions(+)
diff --git a/include/tst_timer.h b/include/tst_timer.h
index 6fb940020..fc0cdb5bc 100644
--- a/include/tst_timer.h
+++ b/include/tst_timer.h
@@ -180,7 +180,11 @@ static inline void *tst_ts_get(struct tst_ts *t)
case TST_KERN_TIMESPEC:
return &t->ts.kern_ts;
default:
+#ifndef TST_NO_LIBLTP
tst_brk(TBROK, "Invalid type: %d", t->type);
+#else
+ abort();
+#endif
return NULL;
}
}
@@ -196,7 +200,11 @@ static inline void *tst_its_get(struct tst_its *t)
case TST_KERN_TIMESPEC:
return &t->ts.kern_its;
default:
+#ifndef TST_NO_LIBLTP
tst_brk(TBROK, "Invalid type: %d", t->type);
+#else
+ abort();
+#endif
return NULL;
}
}
@@ -395,7 +403,11 @@ static inline long long tst_ts_get_sec(struct tst_ts ts)
case TST_KERN_TIMESPEC:
return ts.ts.kern_ts.tv_sec;
default:
+#ifndef TST_NO_LIBLTP
tst_brk(TBROK, "Invalid type: %d", ts.type);
+#else
+ abort();
+#endif
return -1;
}
}
@@ -413,7 +425,11 @@ static inline long long tst_ts_get_nsec(struct tst_ts ts)
case TST_KERN_TIMESPEC:
return ts.ts.kern_ts.tv_nsec;
default:
+#ifndef TST_NO_LIBLTP
tst_brk(TBROK, "Invalid type: %d", ts.type);
+#else
+ abort();
+#endif
return -1;
}
}
--git a/testcases/realtime/func/sched_football/sched_football.c b/testcases/realtime/func/sched_football/sched_football.c
index b6ae692af..6846978f4 100644
--- a/testcases/realtime/func/sched_football/sched_football.c
+++ b/testcases/realtime/func/sched_football/sched_football.c
@@ -74,6 +74,7 @@
#include <librttest.h>
#include <tst_atomic.h>
#define TST_NO_DEFAULT_MAIN
+#define TST_NO_LIBLTP
#include <tst_timer.h>
--
2.44.2
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2024-06-26 13:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 13:30 Cyril Hrubis [this message]
2024-06-26 18:58 ` [LTP] [PATCH v1] include/tst_timer: Add TST_NO_LIBLTP John Stultz via ltp
2024-06-27 10:26 ` Cyril Hrubis
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=20240626133004.15810-1-chrubis@suse.cz \
--to=chrubis@suse.cz \
--cc=darren@os.amperecomputing.com \
--cc=jstultz@google.com \
--cc=kernel-team@android.com \
--cc=ltp@lists.linux.it \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.