Skip to contentSkip to conversation

API: Give user hint when checkpoints were not initialised

PATCH New Richard Palethorpe 4 participants 5 messages May 12, 2021 – May 13, 2021 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 API: Give user hint when checkpoints were not initialised

Currently the user gets an error about EOVERFLOW. This will hopefully save some searching.

---
 lib/tst_checkpoint.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
lib/tst_checkpoint.c +7 -1
index 9e9dcf9e6..13d86c73b 100644
@@ -86,6 +86,9 @@ int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout)
 	struct timespec timeout;
 	int ret;
 
+	if (!tst_max_futexes)
+		tst_brkm(TBROK, NULL, "Set test.needs_checkpoints = 1");
+
 	if (id >= tst_max_futexes) {
 		errno = EOVERFLOW;
 		return -1;
@@ -107,7 +110,10 @@ int tst_checkpoint_wake(unsigned int id, unsigned int nr_wake,
 {
 	unsigned int msecs = 0, waked = 0;
 
-	if (id >= tst_max_futexes) {
+	if (!tst_max_futexes)
+		tst_brkm(TBROK, NULL, "Set test.needs_checkpoints = 1");
+
+        if (id >= tst_max_futexes) {
 		errno = EOVERFLOW;
 		return -1;
 	}
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/1 API: Give user hint when checkpoints were not initialised

Hi!

Quoted 19 lines
---
 lib/tst_checkpoint.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
lib/tst_checkpoint.c +3 -0
index 9e9dcf9e6..13d86c73b 100644
@@ -86,6 +86,9 @@ int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout)
 	struct timespec timeout;
 	int ret;
 
+	if (!tst_max_futexes)
+		tst_brkm(TBROK, NULL, "Set test.needs_checkpoints = 1");
+
 	if (id >= tst_max_futexes) {
 		errno = EOVERFLOW;
 		return -1;

lib/tst_checkpoint.c int tst_checkpoint_wake(unsigned int id, unsigned int nr_wake, · line 116

Quoted 8 lines
lib/tst_checkpoint.c +4 -1
@@ -107,7 +110,10 @@ int tst_checkpoint_wake(unsigned int id, unsigned int nr_wake,
 {
 	unsigned int msecs = 0, waked = 0;
 
-	if (id >= tst_max_futexes) {
+	if (!tst_max_futexes)
+		tst_brkm(TBROK, NULL, "Set test.needs_checkpoints = 1");
+
+        if (id >= tst_max_futexes) {

^
Spaces instead of tabs...

Other than that this looks obviously fine.

Signature · 2 lines
Cyril Hrubis
[email protected]
#3 lore raw

PATCH 1/1 API: Give user hint when checkpoints were not initialised

Hi!

Quoted 4 lines
Quoted 2 lines

Currently the user gets an error about EOVERFLOW. This will hopefully save some searching.

Nice! I'm for merging it before release (with that fixed whitespace).

Looks safe enough, I will fix the whitespaces and apply.

Signature · 2 lines
Cyril Hrubis
[email protected]
#4 lore raw

PATCH 1/1 API: Give user hint when checkpoints were not initialised

Hi,

Quoted 7 lines · Cyril Hrubis

Hi!

Quoted 4 lines
Quoted 2 lines

Currently the user gets an error about EOVERFLOW. This will hopefully save some searching.

Nice! I'm for merging it before release (with that fixed whitespace).

Looks safe enough, I will fix the whitespaces and apply.

Thanks, but I would not put this in the release. There is no advantage to the end user, only test authors. It can only break the tests from an end user POV.

Signature · 2 lines
Thank you,
Richard.