<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>sbrk02 is failing on ia32 architecture, where as this test passed
in other arch's.<br>
</p>
<p>when we check the sbrk02 with below increment value #define INC
16*1024*1024 the error<br>
condition "(void *) -1" met but the errno show the success. below
output will<br>
show fail condition.<br>
<br>
value of increment:: 369098752 return value 0xdb63f000<br>
<br>
errno:: 0sbrk02 0 TINFO : setup() bailing inc: 385875968, ret:
0xffffffff, sbrk: 0xf063f000:<br>
<br>
errno=SUCCESS(0): Success<br>
sbrk_verify:: 385875968<br>
sbrk02 1 TFAIL : sbrk02.c:110: sbrk(385875968) failed
unexpectedly; expected: 12 - Cannot allocate memory:
TEST_ERRNO=SUCCESS(0): Success<br>
<br>
Solution Details:<br>
Since it was failing when the loop check for return value but
error condition doesn't met 0, So added the loop to check the
reverse condition ie errno == 0.<br>
<br>
Signed-off-by : Anup Kumar <a class="moz-txt-link-rfc2396E"
href="mailto:anupkumk@in.ibm.com"><anupkumk@in.ibm.com></a><br>
Signed-off-by : Charishma M <a class="moz-txt-link-rfc2396E"
href="mailto:charism2@in.ibm.com"><charism2@in.ibm.com></a><br>
<br>
---<br>
testcases/kernel/syscalls/sbrk/sbrk02.c | 12 +++++++++++-<br>
1 file changed, 11 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/testcases/kernel/syscalls/sbrk/sbrk02.c
b/testcases/kernel/syscalls/sbrk/sbrk02.c<br>
index 84744ef..60ade4b 100644<br>
--- a/testcases/kernel/syscalls/sbrk/sbrk02.c<br>
+++ b/testcases/kernel/syscalls/sbrk/sbrk02.c<br>
@@ -21,6 +21,7 @@<br>
<br>
#include <errno.h><br>
#include <unistd.h><br>
+#include <sys/types.h><br>
#include "test.h"<br>
<br>
#define INC 16*1024*1024<br>
@@ -55,13 +56,21 @@ int main(int argc, char *argv[])<br>
<br>
static void setup(void)<br>
{<br>
- void *ret = NULL;<br>
<br>
tst_sig(NOFORK, DEF_HANDLER, cleanup);<br>
<br>
TEST_PAUSE;<br>
<br>
/* call sbrk until it fails or increment overflows */<br>
+<br>
+#if defined(__i386__)<br>
+<br>
+ for (increment = INC; errno == 0; increment++)<br>
+ sbrk(increment);<br>
+ tst_resm(TINFO | TERRNO, "setup() bailing inc: %ld, sbrk:
%p",<br>
+ increment, sbrk(0));<br>
+#else<br>
+ void *ret = NULL;<br>
while (ret != (void *)-1 && increment > 0) {<br>
ret = sbrk(increment);<br>
increment += INC;<br>
@@ -70,6 +79,7 @@ static void setup(void)<br>
increment, ret, sbrk(0));<br>
<br>
errno = 0;<br>
+#endif<br>
}<br>
<br>
static void sbrk_verify(void)<br>
-- <br>
2.5.5<br>
<br>
</p>
</body>
</html>