Done.
Regards--
Subrata
Carmelo AMOROSO wrote:
> Carmelo AMOROSO wrote:
>> Hi All,
>> running the LTP on uClibc-nptl for sh4 I get a failure on stack_space
>> test.
>> After some analysis I've found that the default parameters of the
>> test case
>> produce a call to malloc(0).
>> Now, in my uClibc implementation the malloc(0) gives always NULL (while
>> on glibc it returns a random value), so I discovered this issue.
>> Probably it should be better to define a different set of default value.
>>
>> Currently we have:
>>
>> MAXSIZE = 10 * 1024
>> csize = 1024 * 1024
>> nchunks = MAXSIZE / csize
>>
>> bits = (char*) malloc((nchunks + 7)/8) ====> malloc(0)
>>
>> whenever nchunks is < 1, it will try a malloc(0), and I think it is
>> not a good choice as default.
>>
>> or probably we wanted MAXSIZE = 10 * 1024 * 1024 to have at least 10
>> chunks?
>>
>> Best regards,
>> Carmelo
>>
>>
>>
> Hi All,
> I want to go back to this issue (sorry for the typo into the previous
> mail, th testcase is "stack_space" )
> I reviewed the test again, and I am convinced that the default values
> are wrong.
> The fix I suggested previously (defining MAXSIZE = 10 * 1024 * 1024,
> instead of 10*1024) is good
> unless the stack limits is too low (ulimit -s)
> Another possible solution is to reduce the default value of the csize
> variable to 1024.
> Anyway, what the test requires is MAXSIZE to be greater or equal than
> csize....
> that currectly we don't have.
>
> In the attached patch I fixed it choosing MAXSIZE = 10 K and czise = 1 K.
> Further I added a check to verify the csize (if passes as argument)
> doesn't violate its constraint, added some free
> to do memory garbage and minor cleanup
> With this patch the test works fine on glibc and uClibc
>
> Regards,
> Carmelo
>
>
> ------------------------------------------------------------------------
>
> Fix broken testcase: with the default values, the test called malloc(0)
> that on uClibc returns NULL.
> Added 'free' calls to do memory cleanup.
> Added a check to verify that the incoming argument are coherent.
>
> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@...>
>
> --- ltp-full-20070731-orig/testcases/kernel/mem/vmtests/stack_space.c 2007-08-14 13:41:18.940977000 +0200
> +++ ltp-full-20070731/testcases/kernel/mem/vmtests/stack_space.c 2007-08-14 14:26:52.393701000 +0200
> @@ -78,7 +78,7 @@ char *prog; /* invoked name */
> int usage(char* prog)
> {
> tst_resm(TCONF,"Usage: %s <nchild> <chunk_size> <iterations>",prog);
> - tst_resm(TCONF,"DEFAULTS: 20 1048576 50", prog);
> + tst_resm(TCONF,"DEFAULTS: 20 1024 50", prog);
> tst_exit();
> return(0);
> }
> @@ -102,7 +102,7 @@ int main(argc, argv)
>
> if (argc == 1) {
> nchild = 20;
> - csize = K_1*K_1;
> + csize = K_1;
> iterations = 50;
> } else if (argc == 4) {
> i = 1;
> @@ -114,6 +114,10 @@ int main(argc, argv)
> }
> if (sscanf(argv[i++], "%d", &csize) != 1)
> bd_arg(argv[i-1]);
> + if(csize > MAXSIZE) {
> + tst_resm(TBROK,"Chunk size too large , max is %d\n", MAXSIZE);
> + tst_exit();
> + }
> if (sscanf(argv[i++], "%d", &iterations) != 1)
> bd_arg(argv[i-1]);
> } else
> @@ -149,8 +153,7 @@ int runtest()
> exit(0); /* when done, exit */
> }
> if (child < 0) {
> - tst_resm(TBROK,"Fork failed (may be OK if under stress)"
> -);
> + tst_resm(TBROK,"Fork failed (may be OK if under stress)");
> tst_resm(TINFO, "System resource may be too low.\n");
> tst_resm(TBROK, "Reason: %s\n", strerror(errno));
> tst_rmdir();
> @@ -208,9 +211,7 @@ int nchunks;
>
> #define CHUNK(i) ((i) * csize)
>
> -int dotest(testers, me)
> - int testers;
> - int me;
> +int dotest(int testers, int me)
> {
> char *bits;
> char *val_buf;
> @@ -318,6 +319,10 @@ int dotest(testers, me)
> bfill(zero_buf, val, csize);
> ++val;
> }
> + free(bits);
> + free(val_buf);
> + free(zero_buf);
> +
> return(0);
> }
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@...
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
|