librelist archives

« back to archive

tnstrings test error on 32bit

tnstrings test error on 32bit

From:
Loic d'Anterroches
Date:
2011-06-22 @ 08:37
Hello,

building the latest master branch:
$ git log -1
commit 85a4bfc4776c14bc73880ef861ce72cec1271d66
Author: Zed A. Shaw <zedshaw@zedshaw.com>
Date:   Tue Jun 21 09:37:03 2011 -0700

I have this error:
ERROR in test tests/tnetstrings_tests:
----
RUNNING: ./tests/tnetstrings_tests
FAILED: Wrong length on LONG_MAX

I am running a fairly standard 32bit Ubuntu LTS:
$ uname -a
Linux loa-desktop 2.6.32-32-generic-pae #62-Ubuntu SMP Wed Apr 20
22:10:33 UTC 2011 i686 GNU/Linux

Adding a printf(result); gives me:

10:2147483647#

So, it looks like this test is 64bit specific. Is it possible to have a
kind of smart way to handle testing in a mixed 32/64bit environment?

Maybe simply:

    if (LONG_MAX > 2147483647) {
	mu_assert(len == 23, "Wrong length on LONG_MAX");
    } else {
	mu_assert(len == 14, "Wrong length on LONG_MAX");
    }
    free(result);

This is what I put in tests/tnetstrings_tests.c and it works on my 32bit
system. I know next to nothing about "good c" so please ignore this if
an obvious macro can write the right test depending on the architecture.

loïc

--
Indefero - Project management and code hosting - http://www.indefero.net
Photon - High Performance PHP Framework - http://photon-project.com
Céondo Ltd - Web + Science = Fun - http://www.ceondo.com






Re: [mongrel2] tnstrings test error on 32bit

From:
Zed A. Shaw
Date:
2011-06-22 @ 15:27
On Wed, Jun 22, 2011 at 10:37:26AM +0200, Loic d'Anterroches wrote:
> Hello,
> 
> building the latest master branch:
> $ git log -1
> commit 85a4bfc4776c14bc73880ef861ce72cec1271d66
> Author: Zed A. Shaw <zedshaw@zedshaw.com>
> Date:   Tue Jun 21 09:37:03 2011 -0700
> 
> I have this error:
> ERROR in test tests/tnetstrings_tests:

Yep this is fixed in develop and I'm pushing out a quick release today.
There's also some debugging crap that I left in which I'm removing.

-- 
Zed A. Shaw
http://zedshaw.com/