aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonin Delpeuch <antonin@delpeuch.eu>2023-09-20 10:20:20 +0200
committerAntonin Delpeuch <antonin@delpeuch.eu>2023-09-20 10:29:27 +0200
commitb268b72533c805be8da82c728d3c8e9f6249cf23 (patch)
treedeebc34b0a85a8b517a6d017d93466db83dbac0e
parent922f5d08b841557856ff82cae5f72c156bef77d1 (diff)
downloadgit-deps-b268b72533c805be8da82c728d3c8e9f6249cf23.tar.gz
Start test suite of running git-deps on itself
For #4.
-rw-r--r--.github/workflows/CI.yml5
-rw-r--r--tests/expected_outputs/deps_1ba7ad53
-rw-r--r--tests/expected_outputs/deps_4f27a1e7
-rw-r--r--tests/expected_outputs/deps_b1967570
-rwxr-xr-xtests/self_test.sh23
5 files changed, 38 insertions, 0 deletions
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 6dae66e..01e41e6 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -20,6 +20,8 @@ jobs:
steps:
- uses: actions/checkout@v3
+ with:
+ fetch-depth: 0 # fetch the entire repository so that we can use it for our self tests
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
@@ -41,3 +43,6 @@ jobs:
- name: Test with pytest
run: |
pytest
+ - name: Run the self-test suite
+ run: |
+ tests/self_test.sh
diff --git a/tests/expected_outputs/deps_1ba7ad5 b/tests/expected_outputs/deps_1ba7ad5
new file mode 100644
index 0000000..ca9783e
--- /dev/null
+++ b/tests/expected_outputs/deps_1ba7ad5
@@ -0,0 +1,3 @@
+2bd9ea0f03a644cc3f5e7824d9ad0979ccdf94dc
+2c9d23b0291157eb1096384ff76e0122747b9bdf
+c15f0364bf0364b8123b370b78b6d6ac8bf6f779
diff --git a/tests/expected_outputs/deps_4f27a1e b/tests/expected_outputs/deps_4f27a1e
new file mode 100644
index 0000000..6796a68
--- /dev/null
+++ b/tests/expected_outputs/deps_4f27a1e
@@ -0,0 +1,7 @@
+3374b8419a45d91d3c0631be11c8cf893b272217
+3a1dd42fd6114a634ba7cf037ce61e2aee76db73
+5ec5ccbdff508014c61ae9d18f3366a15c0f2689
+80c247fd21a1e7f476d1c8ba289498e216eff3dc
+b144bfd5feb327ef7ce0c26bbfb6f4da573abfe5
+b1967573e81a8100a4cc778936de0ba0a8a8f5cb
+f7bf058439fd7499aad7a10418a9f516e6949fbc
diff --git a/tests/expected_outputs/deps_b196757 b/tests/expected_outputs/deps_b196757
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/expected_outputs/deps_b196757
diff --git a/tests/self_test.sh b/tests/self_test.sh
new file mode 100755
index 0000000..c2ddfb1
--- /dev/null
+++ b/tests/self_test.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -eo pipefail
+
+# Collection of tests consisting in running `git-deps` on its own repository.
+# The expected outputs of various commands are stored in the `expected_outputs` subdirectory.
+
+# Because git-deps can only be run from the repository's root, this script should be run at
+# the root of a clone of git-deps. The clone should not be shallow, so that all refs can be accessed.
+
+echo "Running test suite"
+
+echo "* Dependencies of 4f27a1e, a regular commit"
+git-deps 4f27a1e^! | sort | diff tests/expected_outputs/deps_4f27a1e -
+
+echo "* Dependencies of 1ba7ad5, a merge commit"
+git-deps 1ba7ad5^! | sort | diff tests/expected_outputs/deps_1ba7ad5 -
+
+# Currently failing:
+#echo "* Dependencies of the root commit"
+# git-deps b196757^! | sort # | diff tests/expected_outputs/deps_b196757 -
+
+echo "All tests passed!"