Project

General

Profile

Task #2795

Introduce unit testing

Added by Junxiao Shi almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
High
Assignee:
Start date:
Due date:
% Done:

100%

Estimated time:
3.00 h

Description

Introduce unit testing infrastructure using Boost.Test.


Related issues

Blocks ndn-tools - Feature #2796: Tests for Ping and PingServerClosedEric Newberry

Actions
Blocks ndn-tools - Feature #2670: wscript: build a subset of toolsClosedShock Jiang05/23/2015

Actions
#1

Updated by Junxiao Shi almost 6 years ago

#2

Updated by Junxiao Shi almost 6 years ago

  • Status changed from New to In Progress
#3

Updated by Junxiao Shi almost 6 years ago

  • % Done changed from 0 to 10

http://gerrit.named-data.net/2052

I gave this a shot but there are major difficulties with wscript:

  • tools/foo compiles into one or more executables, not objects. This means it contains main function(s).
  • tools/foo directory structure is only understood by tools/foo/wscript.
  • tools/foo can declare extra dependencies.

tests/wscript needs to:

  • Avoid linking the main function(s) in tools/foo, or skip the file(s) that contains a main function.
  • Understand the directory structure inside tools/foo.
  • Make the unit testing binary depend on the extra dependencies declared in tools/foo.

I'm unsure how to achieve those.

#4

Updated by Alex Afanasyev almost 6 years ago

I'm a little bit confused.

Is the following logic correct:

  • a single unit-tests binary file
  • test cases are .cpp files placed under tests/foo, tests/bar, etc.
  • there could be other .cpp files placed in tests/foo
  • a single unit-tests program is linked to all .o files from all tools (with exception of files containing main function) and all relevant dependencies
#5

Updated by Junxiao Shi almost 6 years ago

Answer to note-4:

I haven't decided whether the unit tests are in a single binary, or one binary per tool; whichever way is easier shall be the way to go.

The other three points are accurate.

#6

Updated by Alex Afanasyev almost 6 years ago

  • Assignee changed from Junxiao Shi to Alex Afanasyev
#7

Updated by Alex Afanasyev almost 6 years ago

  • Assignee changed from Alex Afanasyev to Junxiao Shi
  • % Done changed from 10 to 40
#9

Updated by Junxiao Shi almost 6 years ago

  • Status changed from In Progress to Code review
  • % Done changed from 40 to 100
#10

Updated by Junxiao Shi almost 6 years ago

#11

Updated by Junxiao Shi almost 6 years ago

  • Status changed from Code review to In Progress
  • % Done changed from 100 to 70

I also need to enable unit testing in Jenkins.

#12

Updated by Junxiao Shi almost 6 years ago

  • Status changed from In Progress to Code review
  • % Done changed from 70 to 100
#13

Updated by Junxiao Shi almost 6 years ago

  • Status changed from Code review to Closed

Also available in: Atom PDF