Jump to content

Compilation error when adding a new test suite


Recommended Posts

For #3949, I am trying to add a test. I have written minimal test code (following http://trac.wildfiregames.com/wiki/WritingTests)
 

 * You should have received a copy of the GNU General Public License
 * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "lib/self_test.h"

#include "network/NetServer.h"

class TestCNetServerWorker : public CxxTest::TestSuite
{
public:
        void test_duplicate_guid_auth()
        {
        }
}

 

and have followed with update-workspaces. Running "make" now fails with:
 

==== Building test (release) ====
==== Building ActorEditor (release) ====
test_NetServer.h
test_NetServer.cpp
../../../source/network/tests/test_NetServer.cpp:19:29: error: expected initializer before ‘suite_TestCNetServerWorker’
 static TestCNetServerWorker suite_TestCNetServerWorker;
                             ^
../../../source/network/tests/test_NetServer.cpp:22:150: error: ‘suite_TestCNetServerWorker’ was not declared in this scope
 CxxTest::StaticSuiteDescription suiteDescription_TestCNetServerWorker( "../../../source/network/tests/test_NetServer.h", 22, "TestCNetServerWorker", suite_TestCNetServerWorker, Tests_TestCNetServerWorker );
                                                                                                                                                      ^
../../../source/network/tests/test_NetServer.cpp: In member function ‘virtual void TestDescription_suite_TestCNetServerWorker_test_duplicate_guid_auth::runTest()’:
../../../source/network/tests/test_NetServer.cpp:27:19: error: ‘suite_TestCNetServerWorker’ was not declared in this scope
  void runTest() { suite_TestCNetServerWorker.test_duplicate_guid_auth(); }
                   ^
test.make:418: recipe for target 'obj/test_Release/test_NetServer.o' failed
make[1]: *** [obj/test_Release/test_NetServer.o] Error 1
Makefile:92: recipe for target 'test' failed
make: *** [test] Error 2
sbirmi@burnaby:~/0ad-dev/build/workspaces/gcc$

 

Does this look familiar? I am probably overlooking something obvious.

I have compared the generated network/tests/test_NetMessage.cpp and network/tests/test_NetServer.cpp and both seem to have identical declarations.
 

[test_NetServer.cpp]

  7 #define _CXXTEST_HAVE_STD
  8 #include "precompiled.h"
  9 #include "lib/external_libraries/libsdl.h"
 10 #include <cxxtest/TestListener.h>
 11 #include <cxxtest/TestTracker.h>
 12 #include <cxxtest/TestRunner.h>
 13 #include <cxxtest/RealDescriptions.h>
 14 #include <cxxtest/TestMain.h>
 15
 16 bool suite_TestCNetServerWorker_init = false;
 17 #include "/home/sbirmi/0ad-dev/source/network/tests/test_NetServer.h"
 18
 19 static TestCNetServerWorker suite_TestCNetServerWorker;
 20
 21 static CxxTest::List Tests_TestCNetServerWorker = { 0, 0 };


[test_NetMessage.cpp]

  7 #define _CXXTEST_HAVE_STD
  8 #include "precompiled.h"
  9 #include "lib/external_libraries/libsdl.h"
 10 #include <cxxtest/TestListener.h>
 11 #include <cxxtest/TestTracker.h>
 12 #include <cxxtest/TestRunner.h>
 13 #include <cxxtest/RealDescriptions.h>
 14 #include <cxxtest/TestMain.h>
 15
 16 bool suite_TestNetMessage_init = false;
 17 #include "/home/sbirmi/0ad-dev/source/network/tests/test_NetMessage.h"
 18
 19 static TestNetMessage suite_TestNetMessage;
 20
 21 static CxxTest::List Tests_TestNetMessage = { 0, 0 };

 

Thanks,
Sharad

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...