summaryrefslogtreecommitdiff
path: root/sys/src/cmd/git/test/basic.rc
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2023-02-19 20:44:56 -0500
committerOri Bernstein <ori@eigenstate.org>2023-02-19 20:44:56 -0500
commit31913a8524edf97ad79f9f895d6ac5761b9b2fd7 (patch)
treecc695a76c4a41527eb510c7c9462f059af652636 /sys/src/cmd/git/test/basic.rc
parentc3ba64f6935322f09b6de5c2285544fd471c605d (diff)
mkfiles: add 'mk test' support
9front has several tests scattered throughout the source, as well as more tests in an external 'regress' repository. Many of these tests are broken, because there is no easy way to build and track all of them. This pulls in several tests from different sources, deletes the broken tests, tests with missing data, and adds a single command that can be run from the root of the src directory to test our system. The hope is that as we develop new code, we add more tests, and eventually start running the tests on every commit. Please enter the commit message for your changes. Lines starting
Diffstat (limited to 'sys/src/cmd/git/test/basic.rc')
-rwxr-xr-xsys/src/cmd/git/test/basic.rc67
1 files changed, 67 insertions, 0 deletions
diff --git a/sys/src/cmd/git/test/basic.rc b/sys/src/cmd/git/test/basic.rc
new file mode 100755
index 000000000..875a225cc
--- /dev/null
+++ b/sys/src/cmd/git/test/basic.rc
@@ -0,0 +1,67 @@
+#!/bin/rc
+
+. util.rc
+
+wrkdir=`{pwd}
+rm -fr scratch
+mkdir -p scratch/upstream
+
+echo @@ version1 @@
+@{
+ cd scratch/upstream
+ q $G/init
+ echo version1 > file.txt
+ q $G/add file.txt
+ q $G/commit -m version1 file.txt
+}
+
+@{
+ cd scratch
+ $G/clone $wrkdir/scratch/upstream downstream
+}
+
+diff -c scratch/upstream/file.txt scratch/downstream/file.txt || die mismatch
+
+echo @@ version2 @@
+@{
+ cd scratch/upstream
+ echo version2 > file.txt
+ q $G/commit -m version2 file.txt
+}
+@{
+ cd scratch/downstream
+ q $G/pull
+}
+q diff -c scratch/upstream/file.txt scratch/downstream/file.txt || die mismatch
+
+echo @@ version3 @@
+@{
+ cd scratch/upstream
+ echo version3 > file2.txt
+ $G/add file2.txt
+ q $G/commit -m version3 file2.txt
+}
+@{
+ cd scratch/downstream
+ q $G/pull
+}
+q diff -c scratch/upstream/file.txt scratch/downstream/file.txt || die mismatch
+q diff -c scratch/upstream/file2.txt scratch/downstream/file2.txt || die mismatch
+
+echo @@ version4 @@
+@{
+ cd scratch/upstream
+ echo version4 > file.txt
+ $G/rm file2.txt
+ rm file2.txt
+ q $G/commit -m version4 file.txt file2.txt
+}
+
+@{
+ cd scratch/downstream
+ q $G/pull
+}
+q diff -c scratch/upstream/file.txt scratch/downstream/file.txt || die mismatch
+! test -e scratch/upstream/file2.txt || die mismatch
+! test -e scratch/downstream/file2.txt || die mismatch
+