diff --git a/Makefile.local b/Makefile.local index 081a880..7390c37 100644 --- a/Makefile.local +++ b/Makefile.local @@ -1,91 +1,94 @@ # -*- 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 SWH_DB_MANAGER_CONFIG=~/.config/swh/db-manager.ini deps: apt-get install -y \ python3 \ python3-pygit2 \ python3-psycopg2 \ python3-nose \ python3-flask \ python3-requests \ python3-retrying \ ipython3 clean: rm -rf /tmp/swh-loader-git/content-storage prepare: mkdir -p /tmp/swh-loader-git/content-storage clean-db: clean $(SWH_DB_MANAGER) $(FLAG) --config $(SWH_DB_MANAGER_CONFIG) cleandb +init-db: + $(SWH_DB_MANAGER) $(FLAG) --config $(SWH_DB_MANAGER_CONFIG) initdb + run-remote: $(SWH_LOADER) $(FLAG) --config ./resources/remote-loader-git.ini load $(REPO_PATH) run-local: $(SWH_LOADER) $(FLAG) --config ./resources/local-loader-git.ini load $(REPO_PATH) run: # works with the default ~/.config/swh/loader-git.ini file $(SWH_LOADER) $(FLAG) load $(REPO_PATH) run-back: $(SWH_BACK) $(FLAG) connect-db: psql -d $(DB) create-db: make -C $(SQL_FOLDER) clean filldb DBNAME=$(DB) drop-db: make -C $(SQL_FOLDER) clean dropdb DBNAME=$(DB) 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: python3 -m $(PROFILE_TYPE) -o ./scratch/swhgitloader.$(PROFILE_TYPE) ./scratch/profile-swhgitloader.py profile-stats: ./scratch/analyse-profile.py include Makefile.tests diff --git a/Makefile.tests b/Makefile.tests index 166289c..9456da1 100644 --- a/Makefile.tests +++ b/Makefile.tests @@ -1,80 +1,83 @@ # -*- makefile -*- NOSEFLAGS=--nologcapture -v DB_TEST=$(DB)-test TESTDIR = ./swh/loader/git/tests test-connect-db: psql $(DB_TEST) test-create-db: make create-db DB=$(DB_TEST) test-drop-db: make drop-db DB=$(DB_TEST) test-clean-db: make clean-db SWH_DB_MANAGER_CONFIG=./resources/test/db-manager.ini +test-init-db: + make init-db SWH_DB_MANAGER_CONFIG=./resources/test/db-manager.ini + 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 test-run-back: $(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: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api*.py test-api-post-per-type: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_post_*.py test-api-content: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_content.py test-api-directory: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_directory.py test-api-revision: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_revision.py test-api-release: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_release.py test-api-occurrence: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_occurrence.py test-api-home: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_home.py test-api-origin: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_origin.py test-api-person: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_api_person.py test-date: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_date.py test-remote-loader: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_remote_loader.py test-local-loader: $(NOSE) $(NOSEFLAGS) $(TESTDIR)/test_local_loader.py test-loaders: test-local-loader test-remote-loader