This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Steps to replicate the issue: 1) Create a new C++ application project. 2) Create a new unit test (right click on test files, new CppUnit Test. 3) Finish the wizard with default values. 4) Open Makefile-Release.mk, verify that test target is the main application executable instead of the correct one in Makefile-Debug.mk which is ${TESTDIR}/TestFiles/f1 5) Change project config to Release in the IDE. 6) Right-click on "Test Files" and hit Test. 7) Notice that it is trying to run the main application instead of the unit test. * If you originally had your project config set to Release, creating Unit Tests while in that config will cause the symptoms to appear the other way around (i.e. you can unit test in Release mode, but not in Debug mode). -------------------------- e.g. Makefile-Debug.mk (this is the correct makefile) # Test Directory TESTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tests # Test Files TESTFILES= \ ${TESTDIR}/TestFiles/f1 # Build Test Targets .build-tests-conf: .build-conf ${TESTFILES} ${TESTDIR}/TestFiles/f1: ${TESTDIR}/tests/EmployeeServiceTest.o ${TESTDIR}/tests/TestRunner.o ${OBJECTFILES:%.o=%_nomain.o} ${MKDIR} -p ${TESTDIR}/TestFiles ${LINK.cc} -o ${TESTDIR}/TestFiles/f1 $^ ${LDLIBSOPTIONS} -lcppunit # Run Test Targets .test-conf: @if [ "${TEST}" = "" ]; \ then \ ${TESTDIR}/TestFiles/f1 || true; \ else \ ./${TEST} || true; \ fi -------------------------- e.g. Makefile-Release.mk (IDE stuffed this one up. Note: rcftestserver is the main app executable) # Test Directory TESTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tests # Test Files TESTFILES= \ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/rcftestserver # Build Test Targets .build-tests-conf: .build-conf ${TESTFILES} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/rcftestserver: ${TESTDIR}/tests/EmployeeServiceTest.o ${TESTDIR}/tests/TestRunner.o ${OBJECTFILES:%.o=%_nomain.o} ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/rcftestserver $^ ${LDLIBSOPTIONS} # Run Test Targets .test-conf: @if [ "${TEST}" = "" ]; \ then \ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/rcftestserver || true; \ else \ ./${TEST} || true; \ fi
The same behavior here on OS X as well too. Have got CppUnit from MacPorts (not recognized by NetBeans; have been forced to re-configure the project to take in account /opt/local/{include|lib} as well, BTW). I have changed Makefile-Release.mk manually, no big deal, everything works perfectly from command line. Unfortunately, invocation of build system from NetBeans has restored the original (wrong) Makefile-Release.mk which has led to BUILD FAILED message.
zachsaw, indeed the reason is that only active configuration is configured for unit tests. You can work-around this problem though... For this: - Switch to a 'broken' configuration; - Right-click on a test folder (first-level under 'Test Files'); - in both C/C++ compile categories add '.' (dot) to the 'Include Directories' field; - In 'Linker' category - 'Output' - ${TESTDIR}/TestFiles/f1 (you could copy from 'Debug' configuration) 'Libraries' - click '...' => 'Add Option...' => 'Other Option' => '-lcppunit'
Created attachment 123978 [details] Proposed patch
Nik, take a look at the proposed patch, please... =Andrew
The fix with a code that adds needed options to all (not active only) configuration is http://hg.netbeans.org/cnd-main/rev/212ffca66bd4 However see http://netbeans.org/bugzilla/show_bug.cgi?id=218121
QE have to add editor tests into cnd.unittest test suite
QE have to cover the testcase in cnd.unittest test suite