kcovでbashシェルスクリプトのカバレッジを計測する

http://simonkagstrom.github.io/kcov/

環境

  • Centos6.2

インストール

# yum install cmake
$ mkdir kcov
$ cd kcov
$ wget https://github.com/SimonKagstrom/kcov/archive/v26.tar.gz
$ tar xvzf v26.tar.gz 
$ cd kcov-26
$ cd kcov-26
$ mkdir build
$ cd build
$ cmake ..

エラー

-- The CXX compiler identification is unknown
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find LibElf (missing: LIBELF_LIBRARIES LIBELF_INCLUDE_DIRS)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindLibElf.cmake:50 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  src/CMakeLists.txt:6 (find_package)


-- Configuring incomplete, errors occurred!

続・Common Printing Dialog をビルドしてみた。 - なるひこの Linux Printing お勉強日記

G++を入れる

# yum install gcc-c++
$ cmake ..

まだだめ

$ cmake ..
-- The CXX compiler identification is GNU 4.4.7
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find LibElf (missing: LIBELF_LIBRARIES LIBELF_INCLUDE_DIRS)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindLibElf.cmake:50 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  src/CMakeLists.txt:6 (find_package)


-- Configuring incomplete, errors occurred!
# yum install elfutils-libelf-devel
$ cmake ..

まだだめ

$ cmake ..
-- Found LibElf: /usr/lib64/libelf.so  
-- Could NOT find ElfUtils (missing:  LIBDW_LIBRARIES LIBDW_INCLUDE_DIR) 
-- checking for module 'zlib'
--   package 'zlib' not found
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:279 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPkgConfig.cmake:333 (_pkg_check_modules_internal)
  src/CMakeLists.txt:8 (pkg_check_modules)


-- checking for module 'libcurl'
--   package 'libcurl' not found
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:279 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPkgConfig.cmake:333 (_pkg_check_modules_internal)
  src/CMakeLists.txt:9 (pkg_check_modules)
# yum install zlib-devl
# yum install libcurl
# yum install elfutils-devel
# yum install libcurl-devel

成功

$ make
# make install 


テスト対象
shunit2でテストコードを書いてみる - 試したこととか困ったこととか