CTest:FAQ: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
m (Reverted edits by PltDes (Talk); changed back to last version by Andy)
(Add explicit preformat markup)
Line 28: Line 28:
After adding test using:
After adding test using:


<pre>
  ADD_TEST(MyTest ${EXEC_DIR}/MyTest)
  ADD_TEST(MyTest ${EXEC_DIR}/MyTest)
</pre>


Add test properties for pass and failure:
Add test properties for pass and failure:


<pre>
  SET_TESTS_PROPERTIES(MyTest PROPERTIES FAIL_REGULAR_EXPRESSION "ERROR;FAIL;Test failed")
  SET_TESTS_PROPERTIES(MyTest PROPERTIES FAIL_REGULAR_EXPRESSION "ERROR;FAIL;Test failed")
  SET_TESTS_PROPERTIES(MyTest PROPERTIES PASS_REGULAR_EXPRESSION "Test passed")
  SET_TESTS_PROPERTIES(MyTest PROPERTIES PASS_REGULAR_EXPRESSION "Test passed")
</pre>


== Platform-specific questions ==
== Platform-specific questions ==
Line 40: Line 44:
Currently coverage is only supported on gcc compiler. To perform coverage test, make sure that your code is build with debug symbols, without optimization, and with special flags. These flags are:
Currently coverage is only supported on gcc compiler. To perform coverage test, make sure that your code is build with debug symbols, without optimization, and with special flags. These flags are:


<pre>
  -fprofile-arcs -ftest-coverage
  -fprofile-arcs -ftest-coverage
</pre>


Also make sure to pass these flags to C compiler, CXX compiler, and the linker. For example:
Also make sure to pass these flags to C compiler, CXX compiler, and the linker. For example:


<pre>
   CXXFLAGS="-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage"
   CXXFLAGS="-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage"
   CFLAGS="-g -O0 -Wall -W -fprofile-arcs -ftest-coverage"
   CFLAGS="-g -O0 -Wall -W -fprofile-arcs -ftest-coverage"
   LDFLAGS="-fprofile-arcs -ftest-coverage"
   LDFLAGS="-fprofile-arcs -ftest-coverage"
</pre>


== Nightly Dashboards ==
== Nightly Dashboards ==
Line 57: Line 65:
==== Linux ====
==== Linux ====
Add a cron entry as '''root''' with line:
Add a cron entry as '''root''' with line:
<pre>
  /sbin/shutdown -r now
  /sbin/shutdown -r now
</pre>


==== Windows ====
==== Windows ====
Line 66: Line 76:


Add a cron entry as ''''root''' with line:
Add a cron entry as ''''root''' with line:
<pre>
  /sbin/shutdown -r -y 60  
  /sbin/shutdown -r -y 60  
</pre>


==== SunOS ====
==== SunOS ====


Add a cron entry as ''''root''' with line:
Add a cron entry as ''''root''' with line:
<pre>
  /usr/sbin/sync && /usr/sbin/sync && /usr/sbin/reboot
  /usr/sbin/sync && /usr/sbin/sync && /usr/sbin/reboot
</pre>


{{CMake/Template/Footer}}
{{CMake/Template/Footer}}

Revision as of 18:04, 20 April 2018

General information and availability

What is CTest

CTest is a cross-platform, open-source testing system distributed with CMake. CTest can peform several operations on the source code, that include retrieving from CVS or Subversion repository, configure, build, perform set of predefined runtime tests. It also includes several advanced tests such as coverage and memory checking. The results can be submitted to a Dart testing dashboard.

What is the current release?

CTest release schedule is tied with CMake. This release is available at:

http://www.cmake.org/HTML/Download.html

Nightly development can be accessed through CVS.

See http://www.cmake.org/HTML/Download.html for more information.

I found a Bug! What should I do?

Please report the bug in our bug tracker: http://www.cmake.org/Bug .

Please make sure to look at the old bugs not to include duplicates, include detailed instructions of the bug and how to reproduce it.

I want a new feature in CTest. What should I do?

Report a feature request in our Bug tracker http://www.cmake.org/Bug .

Please make sure to look at the old feature requests not to include duplicates, include detailed instructions of the feature and proposed implementation.

Using CTest

My test does not return non-zero on failure. What can I do?

After adding test using:

 ADD_TEST(MyTest ${EXEC_DIR}/MyTest)

Add test properties for pass and failure:

 SET_TESTS_PROPERTIES(MyTest PROPERTIES FAIL_REGULAR_EXPRESSION "ERROR;FAIL;Test failed")
 SET_TESTS_PROPERTIES(MyTest PROPERTIES PASS_REGULAR_EXPRESSION "Test passed")

Platform-specific questions

How can I perform coverage test?

Currently coverage is only supported on gcc compiler. To perform coverage test, make sure that your code is build with debug symbols, without optimization, and with special flags. These flags are:

 -fprofile-arcs -ftest-coverage

Also make sure to pass these flags to C compiler, CXX compiler, and the linker. For example:

  CXXFLAGS="-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage"
  CFLAGS="-g -O0 -Wall -W -fprofile-arcs -ftest-coverage"
  LDFLAGS="-fprofile-arcs -ftest-coverage"

Nightly Dashboards

Can I script CTest?

Yes, please look at the CTest Scripting Tutorial.

How do I shutdown / reboot the system after the dashboard?

Linux

Add a cron entry as root with line:

 /sbin/shutdown -r now

Windows

HP-UX

Add a cron entry as 'root with line:

 /sbin/shutdown -r -y 60 

SunOS

Add a cron entry as 'root with line:

 /usr/sbin/sync && /usr/sbin/sync && /usr/sbin/reboot



CMake: [Welcome | Site Map]