diff --git a/Makefile.local b/Makefile.local index 091bf4b..22dbadf 100644 --- a/Makefile.local +++ b/Makefile.local @@ -1,95 +1,89 @@ # -*- makefile -*- FLAKE = flake8 BINDIR = bin SRCDIR = swh REPO_PATH=./swh-loader-git-testdata # add -v for example FLAG= DB=softwareheritage-dev SWH_LOADER=$(BINDIR)/swh-loader-git SWH_DB_MANAGER=$(BINDIR)/swh-db-manager SWH_BACK=$(BINDIR)/swh-backend SQL_FOLDER=../swh-storage/sql/ # could use cProfile PROFILE_TYPE=profile FOLLOW_LOG=-f -# Adapt python-path to use other swh modules -_PYPATH=`pwd`:`pwd`/../swh-core:`pwd`/../swh-storage - deps: apt-get install -y \ python3 \ python3-pygit2 \ python3-psycopg2 \ python3-nose \ python3-flask \ python3-requests \ python3-retrying \ ipython3 -cover: - PYTHONPATH=$(_PYPATH) make coverage - clean: rm -rf /tmp/swh-loader-git/content-storage prepare: mkdir -p /tmp/swh-loader-git/content-storage cleandb: clean - PYTHONPATH=$(_PYPATH) $(SWH_DB_MANAGER) $(FLAG) cleandb + $(SWH_DB_MANAGER) $(FLAG) cleandb run-remote: - PYTHONPATH=$(_PYPATH) $(SWH_LOADER) $(FLAG) --config ./resources/remote-loader-git.ini load $(REPO_PATH) + $(SWH_LOADER) $(FLAG) --config ./resources/remote-loader-git.ini load $(REPO_PATH) run-local: - PYTHONPATH=$(_PYPATH) $(SWH_LOADER) $(FLAG) --config ./resources/local-loader-git.ini load $(REPO_PATH) + $(SWH_LOADER) $(FLAG) --config ./resources/local-loader-git.ini load $(REPO_PATH) run: # works with the default ~/.config/swh/loader-git.ini file - PYTHONPATH=$(_PYPATH) $(SWH_LOADER) $(FLAG) load $(REPO_PATH) + $(SWH_LOADER) $(FLAG) load $(REPO_PATH) run-back: - PYTHONPATH=$(_PYPATH) $(SWH_BACK) $(FLAG) + $(SWH_BACK) $(FLAG) connect-db: psql -d $(DB) create-db: - cd $(SQL_FOLDER) && make clean initdb + make -C $(SQL_FOLDER) clean initdb drop-db: - cd $(SQL_FOLDER) && make clean dropdb + make -C $(SQL_FOLDER) clean dropdb check-meta: @echo "Repository: $(REPO_PATH)" @echo "Git metadata:" @$(BINDIR)/dir-git-repo-meta.sh $(REPO_PATH) @echo @echo "DB metadata:" @$(BINDIR)/db-git-repo-meta.sh $(DB) @echo log-loader: tail $(FOLLOW_LOG) /tmp/swh-loader-git/log/sgloader.log log-back: tail $(FOLLOW_LOG) /tmp/swh-loader-git/log/back.log profile-run: - PYTHONPATH=$(_PYPATH) python3 -m $(PROFILE_TYPE) -o ./scratch/swhgitloader.$(PROFILE_TYPE) ./scratch/profile-swhgitloader.py + python3 -m $(PROFILE_TYPE) -o ./scratch/swhgitloader.$(PROFILE_TYPE) ./scratch/profile-swhgitloader.py profile-stats: - PYTHONPATH=$(_PYPATH) ./scratch/analyse-profile.py + ./scratch/analyse-profile.py include Makefile.tests diff --git a/Makefile.tests b/Makefile.tests index ee3627b..5797cae 100644 --- a/Makefile.tests +++ b/Makefile.tests @@ -1,83 +1,80 @@ # -*- makefile -*- NOSEFLAGS=--nologcapture -v DB_TEST=$(DB)-test TESTDIR = ./swh/loader/git/tests test-connect-db: psql $(DB_TEST) test-create-db: - cd $(SQL_FOLDER) && make clean initdb DBNAME=$(DB_TEST) + make -C $(SQL_FOLDER) clean initdb DBNAME=$(DB_TEST) test-drop-db: - cd $(SQL_FOLDER) && make clean dropdb DBNAME=$(DB_TEST) + make -C $(SQL_FOLDER) clean dropdb DBNAME=$(DB_TEST) test-cleandb: - PYTHONPATH=$(_PYPATH) $(SWH_DB_MANAGER) $(FLAG) --config ./resources/test/db-manager.ini cleandb + $(SWH_DB_MANAGER) $(FLAG) --config ./resources/test/db-manager.ini cleandb test-clean: rm -rf /tmp/swh-loader-git/test/ test-prepare: mkdir -p /tmp/swh-loader-git/test/ test-log-back: tail $(FOLLOW_LOG) /tmp/swh-loader-git/test/log/back.log test-check-meta: @echo "DB $(DB_TEST) metadata:" @$(BINDIR)/db-git-repo-meta.sh $(DB_TEST) @echo -tests: - PYTHONPATH=$(_PYPATH) make test - test-run-back: - PYTHONPATH=$(_PYPATH) $(SWH_BACK) $(FLAG) --config ./resources/test/back.ini + $(SWH_BACK) $(FLAG) --config ./resources/test/back.ini test-http: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_http.py test-swhrepo: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_swhrepo.py test-api: - PYTHONPATH=$(_PYPATH) $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api*.py + $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api*.py test-api-post-per-type: - PYTHONPATH=$(_PYPATH) $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_post_*.py + $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_post_*.py test-api-content: - PYTHONPATH=$(_PYPATH) $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_content.py + $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_content.py test-api-directory: - PYTHONPATH=$(_PYPATH) $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_directory.py + $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_directory.py test-api-revision: - PYTHONPATH=$(_PYPATH) $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_revision.py + $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_revision.py test-api-release: - PYTHONPATH=$(_PYPATH) $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_release.py + $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_release.py test-api-occurrence: - PYTHONPATH=$(_PYPATH) $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_occurrence.py + $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_occurrence.py test-api-home: - PYTHONPATH=$(_PYPATH) $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_home.py + $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_home.py test-api-origin: - PYTHONPATH=$(_PYPATH) $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_origin.py + $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_origin.py test-api-person: - PYTHONPATH=$(_PYPATH) $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_person.py + $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_person.py test-file: - PYTHONPATH=$(_PYPATH) $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_file.py + $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_file.py test-remote-loader: - PYTHONPATH=$(_PYPATH) $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_remote_loader.py + $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_remote_loader.py test-local-loader: - PYTHONPATH=$(_PYPATH) $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_local_loader.py + $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_local_loader.py test-loaders: test-local-loader test-remote-loader