diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 724bf7829..221297751 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -5,7 +5,7 @@ Replace this text with a description of the PR. #### Additional information... - [ ] I changed C++ code or build infrastructure. - Please run the test suite and include the output of `cd test && ./problems`. + Please run the test suite and include the output of `cd build/test && make && ./problems`. - [ ] I changed Rust code or build infrastructure. Please run `cargo test` and address any failures before submitting. diff --git a/test/.gitignore b/test/.gitignore deleted file mode 100644 index cdb132ea3..000000000 --- a/test/.gitignore +++ /dev/null @@ -1,41 +0,0 @@ -*.o -*.pyc -*.data -*.sqlite3 -*.log -*.runlog -col.t -dom.t -eval.t -lexer.t -t.t -taskmod.t -tdb2.t -uri.t -util.t -variant_add.t -variant_and.t -variant_cast.t -variant_divide.t -variant_equal.t -variant_exp.t -variant_gt.t -variant_gte.t -variant_inequal.t -variant_lt.t -variant_lte.t -variant_match.t -variant_math.t -variant_modulo.t -variant_multiply.t -variant_nomatch.t -variant_not.t -variant_or.t -variant_partial.t -variant_subtract.t -variant_xor.t -view.t -tc.t -tw-2689.t - -json_test diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 482014895..853abd814 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -18,7 +18,39 @@ include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/taskchampion/lib ${TASK_INCLUDE_DIRS}) -set (test_SRCS col.t dom.t eval.t lexer.t t.t tw-2689.t tdb2.t tc.t util.t variant_add.t variant_and.t variant_cast.t variant_divide.t variant_equal.t variant_exp.t variant_gt.t variant_gte.t variant_inequal.t variant_lt.t variant_lte.t variant_match.t variant_math.t variant_modulo.t variant_multiply.t variant_nomatch.t variant_not.t variant_or.t variant_partial.t variant_subtract.t variant_xor.t view.t) +set (test_SRCS + col.t + dom.t + eval.t + lexer.t + t.t + tw-2689.t + tdb2.t + tc.t + util.t + variant_add.t + variant_and.t + variant_cast.t + variant_divide.t + variant_equal.t + variant_exp.t + variant_gt.t + variant_gte.t + variant_inequal.t + variant_lt.t + variant_lte.t + variant_match.t + variant_math.t + variant_modulo.t + variant_multiply.t + variant_nomatch.t + variant_not.t + variant_or.t + variant_partial.t + variant_subtract.t + variant_xor.t + view.t + ) add_custom_target (test ./run_all --verbose DEPENDS ${test_SRCS} task_executable @@ -37,6 +69,135 @@ endforeach (src_FILE) configure_file(run_all run_all COPYONLY) configure_file(problems problems COPYONLY) +configure_file(bash_tap.sh bash_tap.sh COPYONLY) +configure_file(bash_tap_tw.sh bash_tap_tw.sh COPYONLY) + +add_subdirectory(basetest) +add_subdirectory(simpletap) +set (pythonTests + abbreviation.t + add.t + alias.t + annotate.t + append.t + args.t + bash_completion.t + blocked.t + bulk.t + burndown.t + calc.t + calendar.t + caseless.t + color.cmd.t + color.rules.t + columns.t + commands.t + completed.t + configuration.t + confirmation.t + context.t + count.t + custom.config.t + custom.recur_ind.t + custom.t + custom.tag_ind.t + date.iso.t + dateformat.t + datesort.t + datetime-negative.t + debug.t + default.t + delete.t + denotate.t + dependencies.t + diag.t + diag_color.t + dom2.t + due.t + duplicate.t + edit.t + encoding.t + enpassant.t + exec.t + export.t + feature.559.t + feature.default.project.t + feature.print.empty.columns.t + feature.recurrence.t + feedback.t + filter.t + fontunderline.t + format.t + gc.t + helpers.t + history.t + hooks.env.t + hooks.on-add.t + hooks.on-launch.t + hooks.on-modify.t + hyphenate.t + ids.t + import.t + info.t + limit.t + list.all.projects.t + log.t + logo.t + math.t + modify.t + nag.t + obfuscate.t + oldest.t + operators.t + overdue.t + partial.t + prepend.t + pri_sort.t + project.t + quotes.t + rc.override.t + recurrence.t + reports.t + search.t + sequence.t + shell.t + show.t + sorting.t + special.t + start.t + stats.t + substitute.t + sugar.t + summary.t + tag.t + taskrc.t + timesheet.t + tw-1379.t + tw-1837.t + tw-20.t + tw-2575.t + tw-262.t + tw-295.t + uda.t + uda_orphan.t + uda_report.t + uda_sort.t + undo.t + unicode.t + unique.t + upgrade.t + urgency.t + urgency_inherit.t + uuid.t + verbose.t + version.t + wait.t + hooks.on-exit.t + ) + +foreach (python_Test ${pythonTests}) + configure_file(${python_Test} ${python_Test} COPYONLY) +endforeach(python_Test) #SET(CMAKE_BUILD_TYPE gcov) #SET(CMAKE_CXX_FLAGS_GCOV "--coverage") diff --git a/test/basetest/CMakeLists.txt b/test/basetest/CMakeLists.txt new file mode 100644 index 000000000..f78450e77 --- /dev/null +++ b/test/basetest/CMakeLists.txt @@ -0,0 +1,8 @@ +configure_file(__init__.py __init__.py COPYONLY) +configure_file(compat.py compat.py COPYONLY) +configure_file(exceptions.py exceptions.py COPYONLY) +configure_file(hooks.py hooks.py COPYONLY) +configure_file(meta.py meta.py COPYONLY) +configure_file(task.py task.py COPYONLY) +configure_file(testing.py testing.py COPYONLY) +configure_file(utils.py utils.py) \ No newline at end of file diff --git a/test/basetest/utils.py b/test/basetest/utils.py index 0c8a941d0..c6a1970eb 100644 --- a/test/basetest/utils.py +++ b/test/basetest/utils.py @@ -29,17 +29,17 @@ CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) # Location of binary files (usually the src/ folder) BIN_PREFIX = os.path.abspath( - os.path.join(CURRENT_DIR, "..", "..", "src") + os.path.join("${CMAKE_BINARY_DIR}","src") ) # Default location of test certificates DEFAULT_CERT_PATH = os.path.abspath( - os.path.join(CURRENT_DIR, "..", "test_certs") + os.path.join("${CMAKE_SOURCE_DIR}", "test", "test_certs") ) # Default location of test hooks DEFAULT_HOOK_PATH = os.path.abspath( - os.path.join(CURRENT_DIR, "..", "test_hooks") + os.path.join("${CMAKE_SOURCE_DIR}", "test", "test_hooks") ) diff --git a/test/bash_completion.t b/test/bash_completion.t index c2e479bf2..7c6de41e1 100755 --- a/test/bash_completion.t +++ b/test/bash_completion.t @@ -36,7 +36,7 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__))) from basetest import Task, TestCase from basetest.utils import BIN_PREFIX -TASKSH = os.path.abspath(os.path.join(BIN_PREFIX, "..", "scripts/bash/task.sh")) +TASKSH = os.path.abspath(os.path.join(BIN_PREFIX, "..", "..", "scripts/bash/task.sh")) @contextmanager diff --git a/test/run_all b/test/run_all index 8668d685f..e27e3c571 100755 --- a/test/run_all +++ b/test/run_all @@ -70,7 +70,7 @@ class TestRunner(object): self._outputq = Queue() def _find_tests(self): - for test in glob.glob("*.t") + glob.glob("*.t.exe"): + for test in glob.glob("*.t"): if os.access(test, os.X_OK): # Executables only if self._is_parallelizable(test): @@ -123,7 +123,7 @@ class TestRunner(object): with open(test, 'rb') as fh: header = fh.read(100).split(b"\n") if len(header) >= 2 and \ - ((b"/usr/bin/env python3" in header[0]) or \ + ((b"!#/usr/bin/env python3" in header[0]) or \ (header[1][-14:] == b"bash_tap_tw.sh")): return True else: diff --git a/test/simpletap/CMakeLists.txt b/test/simpletap/CMakeLists.txt new file mode 100644 index 000000000..040a465d6 --- /dev/null +++ b/test/simpletap/CMakeLists.txt @@ -0,0 +1 @@ +configure_file(__init__.py __init__.py COPYONLY) \ No newline at end of file diff --git a/test/template.t b/test/template.t old mode 100644 new mode 100755 diff --git a/test/tw-1379.t b/test/tw-1379.t index 98050fc57..07077ecbc 100755 --- a/test/tw-1379.t +++ b/test/tw-1379.t @@ -41,7 +41,7 @@ class TestBug1379(TestCase): self.t = Task() # Themes are a special case that cannot be set via "task config" with open(self.t.taskrc, 'a') as fh: - fh.write("include " + REPO_DIR + "/doc/rc/no-color.theme\n") + fh.write("include " + REPO_DIR + "/../doc/rc/no-color.theme\n") self.t.config("color.alternate", "") self.t.config("_forcecolor", "1") diff --git a/test/tw-1837.t b/test/tw-1837.t old mode 100644 new mode 100755 diff --git a/test/tw-2575.t b/test/tw-2575.t old mode 100644 new mode 100755