How to establish TDD tool chain in Windows

Source: Internet
Author: User
Tags gcov

"Cygwin + GCC + Unity"

First step: Installing Cygwin and GCC

Detailed steps can refer to http://www.360doc.com/content/12/0506/01/7841810_208951162.shtml

http://blog.csdn.net/bruce0532/article/details/5470215

Step Installation: To Http://cygwin.com, click "Install Cygwin now!". This will first download a GUI installer called Setup.exe, which can download a full cygwin. Follow the instructions on each screen to make the installation easy. The installation mode has "install from Internet", "Download form Internet", "Install from Local Directory" three kinds. Install form Internet is installed directly from the Internet. Select the installation destination path and the path where the installation source files are located. Select a faster site, such as a 163 mirror. The next step is to select the components to install, Note by default, the GCC compiler is not installed, so in "Devel" under "gcc", "MINGW-GCC", "Binutil", "make" The "Skip" on the front point to make it "Keep". If you need a debugger, you can choose GDB. The editor can choose a "Editors" you like to use, or do not select, here to install VIM. In Utils you can choose to install tree , Diff,wget and other useful tools. The next step starts the installation. (If you missed a component during the previous installation, you'll need to follow the same steps if you want to increase the installation.) Installed modules appear as Keep, click Keep can be changed to Uninstall,reinstall and so on. The non-installed display is skip and you need to double-click the Skip tick. )

After loading, double-click the Cygwin icon on the desktop to enter the Cygwin environment (green word). Enter Gcc-v and gdb-v to see the version and ensure that GCC and GDB are installed. Enter CMD to enter the command prompt environment (white), you see the location of the root directory, with vim under/home/xuzhh/src a new suffix named ". C" file (such as "test.c"), enter your program code to save. Enter "Exit" in the Cygwin window, return to the Cygwin environment (green word), and then enter "Gcc-o MyProgram test.c" To compile the build MyProgram.exe. Enter "./myprogram.exe" to run. You can also enter CMD return and enter "MyProgram" to run. If you want to double-click to run in a WINDOWS environment, you must first copy "C:\cygwin\bin\cygwin1.dll" to the "C:\WINDOWS\system32" folder.

Step two: Download the Unity framework

Detailed Steps Reference http://my.oschina.net/bbdlg/blog/78287

: http://throwtheswitch.org/will be linked to GitHub and may not be connected for political reasons, just wait a few days to try again.

The latest Unity directory structure is as follows:

~/unity-master
$ tree-l 1
.
|--Auto
|--docs
|--examples
|--Extras
|--readme.md
|--Release
|--SRC
'--Test

Unity requires Ruby tools for automating operations, and you can download Ruby under Windows in http://rubyinstaller.org/downloads/, choosing to add the Ruby installation path to path when you install it.  if XP, you should choose a lower version, such as 1.9.2 p180, etc. , high version Ruby will not work under XP. Reference http://blog.csdn.net/maylorchao/article/details/15505999

Step three run the example in Unity

Enter \unity-master\examples\example_1, add ostype = Cygwin in makefile, save exit (Cygwin command is not used correctly when not added ) )。

In Cygwin, go to the Example_1 folder, enter the Make command to run the unit test, and the results are as follows, indicating that the toolchain is working properly.

  

Fourth Step Install Lcov Tool view test code coverage

Gcov: Add in Makefile

CFLAGS + =-fprofile-arcscflags +-ftest-coverage
CFLAGS + =--coverage

Run make in Example_1, run the program, and then run Gcov productioncode.c and Gcov PRODUCTIONCODE2.C, generates Productioncode.c.gcov and Productioncode2.c.gcov, which is the coverage data of the text display. Reference http://blog.chinaunix.net/uid-24709751-id-3610658.html

Lcov

Download Lcov, address Https://github.com/linux-test-project/lcov, unzip the file and put it in C:\cygwin\home\. Next, then make install under Cygwin, and the installation is complete.

Lcov use the following methods:

After running the program and Gcov,

Lcov--directory Appdir--zerocounters

Lcov--directory appdir--capture--output-file app.info (the program must run at least 1 times, otherwise it will prompt no DATA/.GCDA files.)

Genhtml App.info

  

  

  

  

  

How to create a TDD tool chain under Windows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.