Skip to contentSkip to conversation

android: pty01: Fix pty01 test for Android.

PATCH Superseded Sandeep Patil 3 participants 5 messages Aug 29, 2017 – Aug 30, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 android: pty01: Fix pty01 test for Android.

The test fails because 'grantpt()' is a no-op in bionic and doesn't set the /dev/pts/X mode to '020600' as expected by the test. The change skips that check if __BIONIC__ is defined so the rest of the test(s) can proceed and detect other failures if any.

---
v1->v2
------
- Change the check from __ANDROID__ to __BIONIC__

 testcases/kernel/pty/pty01.c | 3 +++
 1 file changed, 3 insertions(+)
testcases/kernel/pty/pty01.c +3 -0
index cbcc65c97..283612d55 100644
@@ -99,9 +99,12 @@ static int test1(void)
 		tst_brkm(TBROK, NULL, "uid mismatch");
 	}
 
+	 /* grantpt() is a no-op in bionic. */
+#ifndef __BIONIC__
 	if (st.st_mode != (S_IFCHR | S_IRUSR | S_IWUSR | S_IWGRP)) {
 		tst_brkm(TBROK, NULL, "mode mismatch (mode=%o)", st.st_mode);
 	}
+#endif
 
 	slavefd = open(slavename, O_RDWR);
 	if (slavefd >= 0) {
Signature · 1 line
2.14.1.342.g6490525c54-goog
#1 lore raw

PATCH v2 1/1 android: pty01: Fix pty01 test for Android.

Quoted 21 lines

The test fails because 'grantpt()' is a no-op in bionic and doesn't set the /dev/pts/X mode to '020600' as expected by the test. The change skips that check if __BIONIC__ is defined so the rest of the test(s) can proceed and detect other failures if any.

---
v1->v2
------
- Change the check from __ANDROID__ to __BIONIC__

 testcases/kernel/pty/pty01.c | 3 +++
 1 file changed, 3 insertions(+)
testcases/kernel/pty/pty01.c +0 -0
index cbcc65c97..283612d55 100644
@@ -99,9 +99,12 @@ static int test1(void)
 		tst_brkm(TBROK, NULL, "uid mismatch");
 	}

testcases/kernel/pty/pty01.c static int test1(void) · line 110

Quoted 10 lines
testcases/kernel/pty/pty01.c +3 -0
 
+	 /* grantpt() is a no-op in bionic. */
+#ifndef __BIONIC__
 	if (st.st_mode != (S_IFCHR | S_IRUSR | S_IWUSR | S_IWGRP)) {
 		tst_brkm(TBROK, NULL, "mode mismatch (mode=%o)", st.st_mode);
 	}
+#endif
 
 	slavefd = open(slavename, O_RDWR);
 	if (slavefd >= 0) {

LGTM (tested on Android API level 16).

I wonder, whether it's really better to use __BIONIC__ instead of __ANDROID__ (works with both), but assume it is if it's really bionic specific.

Kind regards,
Petr

#2 lore raw

PATCH v2 1/1 android: pty01: Fix pty01 test for Android.

Quoted 29 lines · Petr Vorel
Quoted 28 lines

The test fails because 'grantpt()' is a no-op in bionic and doesn't set the /dev/pts/X mode to '020600' as expected by the test. The change skips that check if __BIONIC__ is defined so the rest of the test(s) can proceed and detect other failures if any.

---
v1->v2
------
- Change the check from __ANDROID__ to __BIONIC__

 testcases/kernel/pty/pty01.c | 3 +++
 1 file changed, 3 insertions(+)
testcases/kernel/pty/pty01.c +3 -0
index cbcc65c97..283612d55 100644
@@ -99,9 +99,12 @@ static int test1(void)
              tst_brkm(TBROK, NULL, "uid mismatch");
      }
 
+      /* grantpt() is a no-op in bionic. */
+#ifndef __BIONIC__
      if (st.st_mode != (S_IFCHR | S_IRUSR | S_IWUSR | S_IWGRP)) {
              tst_brkm(TBROK, NULL, "mode mismatch (mode=%o)", st.st_mode);
      }
+#endif
Quoted 7 lines

testcases/kernel/pty/pty01.c static int test1(void) · line 110

Quoted 2 lines
testcases/kernel/pty/pty01.c +0 -0
      slavefd = open(slavename, O_RDWR);
      if (slavefd >= 0) {

LGTM (tested on Android API level 16).

I wonder, whether it's really better to use __BIONIC__ instead of __ANDROID__ (works with both), but assume it is if it's really bionic specific.

yeah, grantpt unconditionally does nothing in bionic, regardless of whether you're running on an Android device or a desktop/server Linux box.

Quoted 2 lines

Kind regards,
Petr

#3 lore raw

PATCH v2 1/1 android: pty01: Fix pty01 test for Android.

Hi,

Quoted 6 lines
Quoted 2 lines

I wonder, whether it's really better to use __BIONIC__ instead of __ANDROID__ (works with both), but assume it is if it's really bionic specific.

yeah, grantpt unconditionally does nothing in bionic, regardless of whether you're running on an Android device or a desktop/server Linux box.

OT: I didn't think there would be any use of bionic apart from Android (e.g. Linux /BSD distro using it), but there is one project (not very active now):
https://github.com/gentoobionic/bionic

Kind regards,
Petr

#4 lore raw

PATCH v2 1/1 android: pty01: Fix pty01 test for Android.

Quoted 11 lines · Petr Vorel

Hi,

Quoted 6 lines
Quoted 2 lines

I wonder, whether it's really better to use __BIONIC__ instead of __ANDROID__ (works with both), but assume it is if it's really bionic specific.

yeah, grantpt unconditionally does nothing in bionic, regardless of whether you're running on an Android device or a desktop/server Linux box.

OT: I didn't think there would be any use of bionic apart from Android (e.g. Linux /BSD distro using it), but there is one project (not very active now):
https://github.com/gentoobionic/bionic

we're moving towards it internally for more hermetic builds, which is why we've been running in to a lot of these lately. historically almost no-one ever made a distinction, and almost always chose __ANDROID__ for some reason. (even though __linux__ and __BIONIC__ are usually the more accurate choices.)

Quoted 2 lines

Kind regards,
Petr