#
# SPDX-License-Identifier: GPL-2.0-only
#

.PHONY: pyclean
pyclean:
	@find . -type f \( -name \*~ -o -name \*.pyc \) -delete

.PHONY: tags
tags:
	ctags -R --extras=+fq --python-kinds=+cfmvi

.PHONY: cleantags
cleantags:
	rm -f tags

.PHONY: cleanlogs
cleanlogs:
	rm -rf tuna-20*

.PHONY: clean
clean: pyclean

.PHONY: tests unit-tests test-eperm test-converters test-cpuset test-cpuset-cli test-isolate-cpuset test-run-cpuset test-show-threads-cpuset test-show-threads-cgroups test-all
tests: unit-tests

unit-tests:
	@./tests/run_tests.sh

test-eperm:
	@python3 -m unittest tests.test_eperm_handling -v

test-converters:
	@python3 -m unittest tests.test_converters -v

test-cpuset:
	@sudo python3 -m unittest tests.test_cpuset -v

test-cpuset-cli:
	@sudo python3 -m unittest tests.test_cpuset_cli -v

test-isolate-cpuset:
	@sudo python3 -m unittest tests.test_cpuset_cli.TestTunaIsolateCpusetCLI -v

test-run-cpuset:
	@sudo python3 -m unittest tests.test_cpuset_cli.TestTunaRunCpusetCLI -v

test-show-threads-cpuset:
	@sudo python3 -m unittest tests.test_show_threads_cpuset -v

test-show-threads-cgroups:
	@python3 -m unittest tests.test_show_threads_cgroups.TestExtractCpusetName -v
	@sudo python3 -m unittest tests.test_show_threads_cgroups.TestShowThreadsCgroupsDisplay -v

test-all: test-eperm test-converters test-cpuset test-cpuset-cli test-show-threads-cpuset test-show-threads-cgroups
