Project

General

Profile

Actions

Task #2795

closed

Introduce unit testing

Added by Junxiao Shi over 9 years ago. Updated over 9 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 2 (0 open2 closed)

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
Actions #1

Updated by Junxiao Shi over 9 years ago

Actions #2

Updated by Junxiao Shi over 9 years ago

  • Status changed from New to In Progress
Actions #3

Updated by Junxiao Shi over 9 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.

Actions #4

Updated by Alex Afanasyev over 9 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
Actions #5

Updated by Junxiao Shi over 9 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.

Actions #6

Updated by Alex Afanasyev over 9 years ago

  • Assignee changed from Junxiao Shi to Alex Afanasyev
Actions #7

Updated by Alex Afanasyev over 9 years ago

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

Updated by Junxiao Shi over 9 years ago

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

Updated by Junxiao Shi over 9 years ago

Actions #11

Updated by Junxiao Shi over 9 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.

Actions #12

Updated by Junxiao Shi over 9 years ago

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

Updated by Junxiao Shi over 9 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF