public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v1] include/tst_timer: Add TST_NO_LIBLTP
@ 2024-06-26 13:30 Cyril Hrubis
  2024-06-26 18:58 ` John Stultz via ltp
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2024-06-26 13:30 UTC (permalink / raw)
  To: ltp; +Cc: John Stultz, kernel-team, Darren Hart

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


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-27 10:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-26 13:30 [LTP] [PATCH v1] include/tst_timer: Add TST_NO_LIBLTP Cyril Hrubis
2024-06-26 18:58 ` John Stultz via ltp
2024-06-27 10:26   ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox