buglwIP - A Lightweight TCP/IP stack - Bugs: bug #53396, unit tests build broken for msvc


You are not allowed to post comments on this tracker with your current authentication level.

bug #53396: unit tests build broken for msvc

Submitted by:  Joel Cunningham <jcunningham>
Submitted on:  Wed 21 Mar 2018 01:19:48 AM UTC  
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  Joel Cunningham <jcunningham>
Open/Closed:  Closed Planned Release:  None
lwIP version:  git head

Wed 21 Mar 2018 09:11:59 PM UTC, comment #2: 

So it turned out to be a little stranger than I had thought.

For lwIP_Unittests, opt.h is already being included first before cc.h.  I'm not sure where, but I verified it by testing the following in cc.h:

#error how is this in here?

And the error is present

For lwIP_Tests, opt.h is not included first (as expected).

So for now, I've just used


to guard:

void lwip_win32_platform_diag(const char *format, ...);
#define LWIP_PLATFORM_DIAG(x) lwip_win32_platform_diag x

(see commit 194dee99568eebda3b2deeb8cce19ca01095816e)

Both builds are working!  We could do some additional cleanup if opt.h being included first before cc.h for lwIP_Unittests is undesirable longer term

Joel Cunningham <jcunningham>
Project MemberIn charge of this item.
Wed 21 Mar 2018 08:09:44 PM UTC, comment #1: 

A solution would be to define LWIP_TESTMODE on the command line (i.e. in the MSVC project settings).

Simon Goldschmidt <goldsimon>
Project Administrator
Wed 21 Mar 2018 01:19:48 AM UTC, original submission:  

Unit tests no longer build on msvc due to a link failure:

Error 33 error LNK2001: unresolved external symbol _lwip_win32_platform_diag E:\projects\lwip-contrib\ports\win32\msvc\lwIP.lib(pbuf.obj) lwip_unittests

The unit test is relying on the port's cc.h rather than using a unit test specific cc.h.  This means we need to disable mapping LWIP_PLATFORM_DIAG to lwip_win32_platform_diag during the unit test build.  I took a stab a using LWIP_TESTMODE, but the problem is that's defined in opt.h, which is not included in/before cc.h resulting in an undefined token when trying to do #if !LWIP_TESTMODE

Other option would be to add a definition for lwip_win32_platform_diag to the unit test sys_arch.c, but this feels hacky to me.  Maybe there's another symbol we can use that's defined during the unit test?

Joel Cunningham <jcunningham>
Project MemberIn charge of this item.


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by jcunningham (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-03-21 jcunningham StatusNone => Fixed
        Assigned toNone => jcunningham
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.5