Skip to content

Commit

Permalink
Integrate Unittests from UnitTest Repository into this repository on …
Browse files Browse the repository at this point in the history
…the fly (#553)

* Removed unittest from makefile instead download makefile from UnitTest Repository and run the downloaded one

* Renamed test folder to UnitTest

Moved test files to UnitTest/tests folder.

* travis.yml

run two make processes and ignore deleted files in cover report
  • Loading branch information
sidey79 authored Apr 11, 2019
1 parent fdc7e17 commit 3646f57
Show file tree
Hide file tree
Showing 39 changed files with 26 additions and 762 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ install:
- sudo apt-get install fhem -y
- sudo chown travis -R /opt/fhem
script:
- make test
- make test -j2
- ./build_controls_list.sh
- git commit -m "Travis automatic update controls file. Build (${TRAVIS_BUILD_NUMBER}) [skip ci]" ./controls_signalduino.txt || true
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [[ $TRAVIS_JOB_NUMBER == *.1 ]]; then git push origin HEAD:$TRAVIS_BRANCH ; fi'
- cp -R /opt/fhem/cover_db ./
- git --no-pager diff --name-only $TRAVIS_COMMIT_RANGE | grep .pm | xargs -I@ echo -select @ | xargs cover -report coveralls
- git --no-pager diff --diff-filter=d --name-only $TRAVIS_COMMIT_RANGE | grep .pm | xargs -I@ echo -select @ | xargs cover -report coveralls
71 changes: 22 additions & 49 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,50 +1,23 @@
/opt/fhem/FHEM/%.pm: FHEM/%.pm
sudo cp $< $@
98_UnitTest.pm: test/98_unittest.pm
sudo cp $< /opt/fhem/FHEM/$@

## deploylocal: /opt/fhem/FHEM/00_SIGNALduino.pm /opt/fhem/FHEM/10_FS10.pm /opt/fhem/FHEM/14_SD_WS.pm 98_UnitTest.pm /opt/fhem/FHEM/90_SIGNALduino_un.pm /opt/fhem/FHEM/lib/signalduino_protocols.hash
deploylocal : 98_UnitTest.pm
sudo cp FHEM/*.pm /opt/fhem/FHEM/
sudo cp FHEM/lib/*.pm /opt/fhem/FHEM/lib
sudo cp test/*.json /opt/fhem/FHEM/lib
sudo cp test/*.pm /opt/fhem/FHEM/lib
sudo timeout 3 killall -qws2 perl || sudo killall -qws9 perl || true
sudo rm /opt/fhem/log/fhem-*.log || true
sudo cp test/fhem.cfg /opt/fhem/fhem.cfg
sudo rm /opt/fhem/log/fhem.save || true
TZ=Europe/Berlin
cd /opt/fhem && perl -MDevel::Cover fhem.pl fhem.cfg && cd ${TRAVIS_BUILD_DIR}
.PHONY: test UnitTest/makefile deploylocalLibs clean
space:=
space+=

MAKEFILE_DIR:=$(subst $(space),\$(space),$(shell dirname $(subst $(space),\$(space),$(realpath $(lastword $(MAKEFILE_LIST))))))

deploylocalLibs:
@cp $(MAKEFILE_DIR)/UnitTest/FHEM/lib/*.pm /opt/fhem/FHEM/lib
@cp $(MAKEFILE_DIR)/UnitTest/FHEM/lib/*.json /opt/fhem/FHEM/lib
@cp $(MAKEFILE_DIR)/FHEM/lib/*.pm /opt/fhem/FHEM/lib


test: deploylocal
@echo === running commandref test ===
git --no-pager diff --name-only ${TRAVIS_COMMIT_RANGE} | egrep "\.pm" | xargs -I@ echo -select @ | xargs --no-run-if-empty perl /opt/fhem/contrib/commandref_join.pl
@echo === running unit tests ===
test/test-runner.sh test_modules
test/test-runner.sh test_SD_Protocols
test/test-runner.sh test_defineDefaults
test/test-runner.sh test_callsub_1
test/test-runner.sh test1
test/test-runner.sh test3
test/test-runner.sh test4
test/test-runner.sh test_mu_1
test/test-runner.sh test_MS_2
test/test-runner.sh test_loadprotohash
test/test-runner.sh test_developid_1
test/test-runner.sh test_proto44
test/test-runner.sh test_proto46
test/test-runner.sh test_proto57
test/test-runner.sh test_proto84
test/test-runner.sh test_proto85
test/test-runner.sh test_fingerprint
test/test-runner.sh test_firmware_download_1
test/test-runner.sh test_modulematch_1
test/test-runner.sh test_sub_SIGNALduino_OSV2
test/test-runner.sh test_sub_MCTFA
test/test-runner.sh test_sub_SIGNALduino_getAttrDevelopment
test/test-runner.sh test_set_sendMsg
test/test-runner.sh test_read
test/test-runner.sh test_SDWS07
test/test-runner.sh test_SDWS
@echo === finished unit tests ===
sudo timeout 30 killall -vw perl || sudo killall -vws9 perl
UnitTest/makefile:
@mkdir -p $(dir $@)
@test -f $@ || wget -O $@ https://raw.githubusercontent.com/RFD-FHEM/UnitTest/master/makefile

test: UnitTest/makefile deploylocalLibs
${MAKE} -f $< setupEnv test PERL_OPTS="-MDevel::Cover"

clean: UnitTest/makefile
${MAKE} -f $< clean
@rm UnitTest/makefile || true

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ defmod test_proto46 UnitTest dummyDuino (
is( ($SD_Dispatch->called_with)[4], "46", "SIGNALduno_Dispatch check id" );
is( ($SD_Dispatch->called_with)[2], "P46#BAFB0", "SIGNALduno_Dispatch check dmsg" );
}
)
)

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion test/00-list-dummyduino-cmd.txt

This file was deleted.

8 changes: 0 additions & 8 deletions test/00-list-dummyduino-excl.txt

This file was deleted.

128 changes: 0 additions & 128 deletions test/00-list-dummyduino-res.txt

This file was deleted.

Loading

0 comments on commit 3646f57

Please sign in to comment.