FROM centos #ARG KCOV_GIT_REF RUN yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel RUN yum install -y cmake RUN yum install -y make RUN yum install -y gcc-c++ # INSTALL BATS CORE 1.1.0 RUN mkdir -p ~/src/bats-core/bats-core; git clone https://github.com/bats-core/bats-core.git ~/src/bats-core/bats-core && \cd ~/src/bats-core/bats-core && \ git checkout -b 1.1.0 #weird but works ... this installs "bats" exe here: ~/src/bats-core/bats-core/bin/bats #SO: no need for this "./install.sh ~/src/bats-core/bats-core" #Dependencies to build KCOV from source RUN yum install -y elfutils-libelf-devel libcurl-devel binutils-devel elfutils-devel RUN yum install -y binutils-devel zlib-devel libcurl-devel #BUILD KCOV from Source - version 34!!! # Note: path is a bit different from @mbland RUN mkdir -p ~/src/SimonKagstrom/kcov ; \ cd ~/src/SimonKagstrom/kcov && git clone https://github.com/SimonKagstrom/kcov.git && \ cd kcov && git checkout tags/v34 && \ #we are inside: cd ~/src/SimonKagstrom/kcov/kcov/ && cd ~/src/SimonKagstrom/kcov/kcov/ && \ cmake . && make && make install # Setup files to test MBLAND's theory... # https://github.com/bats-core/bats-core/issues/15#issuecomment-403850313 RUN mkdir -p ~/src/tmp/tests/ # HOW TO RUN THIS .... #1. TODO: Build the modified docker image from this Dockerfile # Running this command at a terminal (remove quotes): "docker build --label centos-111 --tag centos-111 /usr/src/theUSER/centos_docker/" #note: the last parameter above is where THIS dockerfile is at... i.e.: /usr/src/theUSER/centos_docker is where I keep mine. #2. Run the docker image and map the files correctly by running the following 2 lines... #docker container rm centos-111 ; \ #docker run -i -t --name "centos-111" -v /usr/src/theUSER/Bats_Tests/tests:/root/src/tmp/tests -v /usr/src/theUSER/Bats_Tests/:/root/src/tmp/ --entrypoint /bin/bash centos-111 #Note: you can see where I keep the 'test file called hello.bats' is /sr/src/theUSER/Bats_Tests/tests and we pass this into the container to /root/src/tmp/tests as MBLAND expects; etc. #3. NOTE: u may skip this step. # Once inside the container: u can run this command to sanity-check that Bats actually works .... # Command: ~/src/bats-core/bats-core/bin/bats -t /root/src/tmp/tests/hello.bats #Note: u can check the test file with this command: vi /root/src/tmp/tests/hello.bats #4. FAILING PART: Run KCOV and bats v34 as MBLAND suggests... #Inside the contianer, copy and paste these linked commands to run them... #Command: #cd ~/src/tmp && \ #rm -rf ~/src/tmp/coverage ; \ #kcov --include-path=~/src/tmp ~/src/tmp/coverage \ # ~/src/bats-core/bats-core/bin/bats ~/src/tmp/tests/ # Note: U can run this command to check coverage... # Command: vi ~/src/tmp/coverage/index.json #PROBLEM: notice that only "bats" executable shows up... but no hello.sh file :/ #ENTRYPOINT ["kcov"] #CMD ["--help"] CMD ["/bin/bash"]