summaryrefslogtreecommitdiffstats
path: root/llvm/utils/lit/tests/Inputs/shtest-shell
diff options
context:
space:
mode:
authorMax Moroz <mmoroz@chromium.org>2018-01-09 18:23:34 +0000
committerMax Moroz <mmoroz@chromium.org>2018-01-09 18:23:34 +0000
commit975eacada575198728353ce53e3d30b9b6404b07 (patch)
tree7fb4cb41e3da60c53a262b019c324a09ad1be223 /llvm/utils/lit/tests/Inputs/shtest-shell
parentc4d2dd80b6d6bd446bfdbba0e084f1769aef59b6 (diff)
downloadbcm5719-llvm-975eacada575198728353ce53e3d30b9b6404b07.tar.gz
bcm5719-llvm-975eacada575198728353ce53e3d30b9b6404b07.zip
[lit] Implement "-r" option for builtin "diff" command + a test using that.
Summary: That would allow to recursively compare directories in tests using "diff -r" on Windows in a similar way as it can be done on Linux or Mac. Reviewers: zturner, morehouse, vsk Reviewed By: zturner Subscribers: kcc, llvm-commits Differential Revision: https://reviews.llvm.org/D41776 llvm-svn: 322102
Diffstat (limited to 'llvm/utils/lit/tests/Inputs/shtest-shell')
-rw-r--r--llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-0.txt8
-rw-r--r--llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-1.txt9
-rw-r--r--llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-2.txt7
-rw-r--r--llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-3.txt7
-rw-r--r--llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-4.txt8
-rw-r--r--llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-5.txt8
-rw-r--r--llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-6.txt8
-rw-r--r--llvm/utils/lit/tests/Inputs/shtest-shell/diff-r.txt20
8 files changed, 75 insertions, 0 deletions
diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-0.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-0.txt
new file mode 100644
index 00000000000..ae571c14f35
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-0.txt
@@ -0,0 +1,8 @@
+# Create two directories for further comparison.
+# RUN: rm -rf %t/dir1 %t/dir2
+# RUN: mkdir -p %t/dir1 %t/dir2
+
+# Add two empty files with different names, "diff -r" should fail.
+# RUN: touch %t/dir1/dir1unique
+# RUN: touch %t/dir2/dir2unique
+# RUN: diff -r %t/dir1 %t/dir2
diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-1.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-1.txt
new file mode 100644
index 00000000000..c68510ddba0
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-1.txt
@@ -0,0 +1,9 @@
+# Create two directories for further comparison.
+# RUN: rm -rf %t/dir1 %t/dir2
+# RUN: mkdir -p %t/dir1 %t/dir2
+
+# Same filenames in subdirs with different content, "diff -r" should fail.
+# RUN: mkdir -p %t/dir1/subdir %t/dir2/subdir
+# RUN: echo "12345" > %t/dir1/subdir/f01
+# RUN: echo "00000" > %t/dir2/subdir/f01
+# RUN: diff -r %t/dir1 %t/dir2
diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-2.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-2.txt
new file mode 100644
index 00000000000..43162614654
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-2.txt
@@ -0,0 +1,7 @@
+# Create two directories for further comparison.
+# RUN: rm -rf %t/dir1 %t/dir2
+# RUN: mkdir -p %t/dir1 %t/dir2
+
+# An extra file in one of the directories, "diff -r" should fail.
+# RUN: echo extra > %t/dir2/extrafile
+# RUN: diff -r %t/dir1 %t/dir2 \ No newline at end of file
diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-3.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-3.txt
new file mode 100644
index 00000000000..62cede34e82
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-3.txt
@@ -0,0 +1,7 @@
+# Create two directories for further comparison.
+# RUN: rm -rf %t/dir1 %t/dir2
+# RUN: mkdir -p %t/dir1 %t/dir2
+
+# An extra directory in one of the directories, "diff -r" should fail.
+# RUN: mkdir -p %t/dir1/extra_subdir
+# RUN: diff -r %t/dir1 %t/dir2
diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-4.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-4.txt
new file mode 100644
index 00000000000..7abec5e6447
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-4.txt
@@ -0,0 +1,8 @@
+# Create two directories for further comparison.
+# RUN: rm -rf %t/dir1 %t/dir2
+# RUN: mkdir -p %t/dir1 %t/dir2
+
+# Directory vs. File mismatch, "diff -r" should fail.
+# RUN: mkdir -p %t/dir1/extra_subdir
+# RUN: echo ZYX > %t/dir2/extra_subdir
+# RUN: diff -r %t/dir1 %t/dir2
diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-5.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-5.txt
new file mode 100644
index 00000000000..4f752d70d8a
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-5.txt
@@ -0,0 +1,8 @@
+# Create two directories for further comparison.
+# RUN: rm -rf %t/dir1 %t/dir2
+# RUN: mkdir -p %t/dir1 %t/dir2
+
+# Non-empty extra directory, "diff -r" should fail.
+# RUN: mkdir -p %t/dir1/extra_subdir
+# RUN: echo ZYX > %t/dir1/extra_subdir/extra_file
+# RUN: diff -r %t/dir1 %t/dir2
diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-6.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-6.txt
new file mode 100644
index 00000000000..391e3517fca
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-6.txt
@@ -0,0 +1,8 @@
+# Create two directories for further comparison.
+# RUN: rm -rf %t/dir1 %t/dir2
+# RUN: mkdir -p %t/dir1 %t/dir2
+
+# Empty file vs directory mismatch, diff -r should fail.
+# RUN: echo -n > %t/dir1/extra_file
+# RUN: mkdir -p %t/dir2/extra_file
+# RUN: diff -r %t/dir1 %t/dir2
diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r.txt
new file mode 100644
index 00000000000..c145cab6a49
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-r.txt
@@ -0,0 +1,20 @@
+# Check recursive diff ("diff -r").
+
+# Create two directories for further comparison.
+# RUN: rm -rf %t/dir1 %t/dir2
+# RUN: mkdir -p %t/dir1 %t/dir2
+
+# Create same files in both of the dirs.
+# RUN: echo "hello" > %t/dir1/f1
+# RUN: echo "hello" > %t/dir2/f1
+
+# Create same subdirectories with same contents.
+# RUN: mkdir -p %t/dir1/subdir %t/dir2/subdir
+# RUN: echo "12345" > %t/dir1/subdir/f01
+# RUN: echo "12345" > %t/dir2/subdir/f01
+# RUN: echo -e "xxx\nzzz\nyyy" > %t/dir1/subdir/f02
+# RUN: echo -e "xxx\nzzz\nyyy" > %t/dir2/subdir/f02
+
+# Create empty subdirectories with same names.
+# RUN: mkdir -p %t/dir1/empty_subdir %t/dir2/empty_subdir
+# RUN: diff -r %t/dir1 %t/dir2
OpenPOWER on IntegriCloud