[LTP] [PATCH v1] include/tst_timer: Add TST_NO_LIBLTP
Cyril Hrubis
chrubis@suse.cz
Wed Jun 26 15:30:04 CEST 2024
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 ++++++++++++++++
.../func/sched_football/sched_football.c | 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;
}
}
diff --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
More information about the ltp
mailing list