#723 improve test and clean targets in Makefiles
Merged 4 years ago by tkopecek. Opened 6 years ago by julian8628.
julian8628/koji makefile-test  into  master

file modified
+5
@@ -1,6 +1,8 @@ 

  [run]

+ data_file = .coverage2

  

  omit =

+     setup.py

      /usr/*

      tests/*

  
@@ -8,3 +10,6 @@ 

  exclude_lines =

      pragma: no cover

      no cover: 2.x

+ 

+ [html]

+ directory = htmlcov/py2

file modified
+5
@@ -1,8 +1,10 @@ 

  [run]

+ data_file = .coverage3

  

  ; extra omissions for py3 for now

  

  omit =

+     setup.py

      /usr/*

      tests/*

  
@@ -11,3 +13,6 @@ 

      pragma: no cover

      no cover 3.x

      if six.PY2

+ 

+ [html]

+ directory = htmlcov/py3

file modified
+1
@@ -10,6 +10,7 @@ 

  #

  # coverage artifacts

  .coverage

+ .coverage[23]

  htmlcov/

  *,cover

  #

file modified
+15 -5
@@ -61,29 +61,39 @@ 

  

  clean:

  	rm -f *.o *.so *.pyc *~ koji*.bz2 koji*.src.rpm

+ 	rm -rf __pycache__

+ 	rm -rf devtools/fakehubc devtools/fakewebc devtools/__pycache__

  	rm -rf koji-$(VERSION)

  	for d in $(SUBDIRS); do make -s -C $$d clean; done

- 	coverage erase ||:

+ 	find ./tests -name "__pycache__" -exec rm -rf {} \; ||:

+ 	find ./tests -name "*.pyc" -exec rm -f {} \;

+ 	rm -rf docs/source/__pycache__ docs/source/*.pyc

+ 	coverage2 erase ||:

+ 	coverage3 erase --rcfile .coveragerc3 ||:

+ 	rm -rf htmlcov

  

  git-clean:

  	@git clean -d -q -x

  

- test:

+ test: test2 test3

+ 	@echo "All tests are finished for python 2&3"

+ 

+ test2:

  	coverage2 erase

  	PYTHONPATH=hub/.:plugins/hub/.:plugins/builder/.:plugins/cli/.:cli/.:www/lib coverage2 run \

  	    --source . /usr/bin/nosetests

  	coverage2 report

  	coverage2 html

- 	@echo Full coverage report at file://$(CURDIR)/htmlcov/index.html

+ 	@echo Full coverage report at file://${CURDIR}/htmlcov/py2/index.html

  

  test3:

- 	coverage3 erase

+ 	coverage3 erase --rcfile .coveragerc3

  	PYTHONPATH=hub/.:plugins/hub/.:plugins/builder/.:plugins/cli/.:cli/.:www/lib coverage3 run \

  	    --rcfile .coveragerc3 --source . \

  	    /usr/bin/nosetests-3

  	coverage3 report --rcfile .coveragerc3

  	coverage3 html --rcfile .coveragerc3

- 	@echo Full coverage report at file://$(CURDIR)/htmlcov/index.html

+ 	@echo Full coverage report at file://${CURDIR}/htmlcov/py3/index.html

  

  test-tarball:

  	@rm -rf .koji-$(VERSION)

file modified
+1
@@ -8,6 +8,7 @@ 

  

  clean:

  	rm -f *.o *.so *.pyc *~ kojidc

+ 	rm -rf __pycache__

  

  

  _install:

file modified
+2
@@ -13,6 +13,8 @@ 

  

  clean:

  	rm -f *.o *.so *.pyc *~ kojic

+ 	rm -rf __pycache__

+ 	for d in $(SUBDIRS); do make -s -C $$d clean; done

  

  install:

  	@if [ "$(DESTDIR)" = "" ]; then \

file modified
+1
@@ -11,6 +11,7 @@ 

  

  clean:

  	rm -f *.o *.so *.pyc *~

+ 	rm -rf __pycache__

  

  install:

  	@if [ "$(DESTDIR)" = "" ]; then \

file modified
+1
@@ -13,6 +13,7 @@ 

  

  clean:

  	rm -f *.o *.so *.pyc *~

+ 	rm -rf __pycache__

  

  install:

  	@if [ "$(DESTDIR)" = "" ]; then \

file modified
+1 -1
@@ -12,7 +12,7 @@ 

  

  clean:

  	rm -f *.o *.so *.pyc *~

- 	for d in $(SUBDIRS); do make -s -C $$d clean; done

+ 	rm -rf __pycache__

  

  install:

  	mkdir -p $(DESTDIR)/$(PKGDIR)

file modified
+2 -1
@@ -21,7 +21,8 @@ 

  	@echo "nothing to make.  try make install"

  

  clean:

- 	rm -f *.o *.so *.pyc *.pyo *~

+ 	find . -name "__pycache__" -exec rm -rf {} \; ||:

+ 	find . -name "*.pyc" -exec rm -f {} \;

  

  install:

  	@if [ "$(DESTDIR)" = "" ]; then \

file modified
+3 -3
@@ -26,8 +26,8 @@ 

      return output

  

  

- def run_test():

-     return checkout_run(['make', 'test'])

+ def run_test2():

+     return checkout_run(['make', 'test2'])

  

  

  def run_test3():
@@ -38,7 +38,7 @@ 

      """Run our test targets in parallel using fresh checkouts of HEAD"""

      print("Running tests...")

      p = Pool(2)

-     results = [p.apply_async(f) for f in [run_test, run_test3]]

+     results = [p.apply_async(f) for f in [run_test2, run_test3]]

      for r in results:

          print(r.get().decode('utf-8'))

      p.close()

file modified
+1
@@ -7,6 +7,7 @@ 

  

  clean:

  	rm -f *.o *.so *.pyc *~

+ 	rm -rf __pycache__

  	for b in $(BINFILES); do rm -f $${b}c; done

  

  _install:

file modified
+1
@@ -8,6 +8,7 @@ 

  

  clean:

  	rm -f *.o *.so *.pyc *~

+ 	rm -rf __pycache__

  	for d in $(SUBDIRS); do make -s -C $$d clean; done

  

  install:

@@ -13,6 +13,7 @@ 

  

  clean:

  	rm -f *.o *.so *.pyc *~

+ 	rm -rf __pycache__

  	for d in $(SUBDIRS); do make -s -C $$d clean; done

  

  install:

  • add test2 for py2 and make test to invoke test2 test3
  • clean .pyc and __pycache__

fixes: #1539

rebased onto 8c958d8a82b83ac4c7b3644a8541f20beae5cbfd

6 years ago

With #718 merged already, this will need to be rebased and the runtests script adjusted.

rebased onto b1f465e45bc4124e9466db52fe26a3589a6e8188

6 years ago

1 new commit added

  • runtest adjusting
6 years ago

rebased onto 8f776d6430ad0765d67a15915f043389a8b8e600

6 years ago

rebased onto 7bacb06

4 years ago

1 new commit added

  • fixes typo in test3
4 years ago

Commit c292242 fixes this pull-request

Pull-Request has been merged by tkopecek

4 years ago