summaryrefslogtreecommitdiffstats
path: root/llvm/utils/lit/tests
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/utils/lit/tests')
-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
-rw-r--r--llvm/utils/lit/tests/max-failures.py2
-rw-r--r--llvm/utils/lit/tests/shtest-shell.py57
10 files changed, 132 insertions, 2 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
diff --git a/llvm/utils/lit/tests/max-failures.py b/llvm/utils/lit/tests/max-failures.py
index c86d7b7fbdc..8628b68a1b9 100644
--- a/llvm/utils/lit/tests/max-failures.py
+++ b/llvm/utils/lit/tests/max-failures.py
@@ -8,7 +8,7 @@
#
# END.
-# CHECK: Failing Tests (17)
+# CHECK: Failing Tests (24)
# CHECK: Failing Tests (1)
# CHECK: Failing Tests (2)
# CHECK: error: Setting --max-failures to 0 does not have any effect.
diff --git a/llvm/utils/lit/tests/shtest-shell.py b/llvm/utils/lit/tests/shtest-shell.py
index 723842fce04..b3e6a2c78f2 100644
--- a/llvm/utils/lit/tests/shtest-shell.py
+++ b/llvm/utils/lit/tests/shtest-shell.py
@@ -71,6 +71,61 @@
# CHECK: error: command failed with exit status: 127
# CHECK: ***
+# CHECK: FAIL: shtest-shell :: diff-r-error-0.txt
+# CHECK: *** TEST 'shtest-shell :: diff-r-error-0.txt' FAILED ***
+# CEHCK: $ "diff" "-r"
+# CHECK: # command output:
+# CHECK: Only in {{.*}}dir1: dir1unique
+# CHECK: Only in {{.*}}dir2: dir2unique
+# CHECK: error: command failed with exit status: 1
+
+# CHECK: FAIL: shtest-shell :: diff-r-error-1.txt
+# CHECK: *** TEST 'shtest-shell :: diff-r-error-1.txt' FAILED ***
+# CEHCK: $ "diff" "-r"
+# CHECK: # command output:
+# CHECK: *** {{.*}}dir1{{.*}}subdir{{.*}}f01
+# CHECK: --- {{.*}}dir2{{.*}}subdir{{.*}}f01
+# CHECK: 12345
+# CHECK: 00000
+# CHECK: error: command failed with exit status: 1
+
+# CHECK: FAIL: shtest-shell :: diff-r-error-2.txt
+# CHECK: *** TEST 'shtest-shell :: diff-r-error-2.txt' FAILED ***
+# CEHCK: $ "diff" "-r"
+# CHECK: # command output:
+# CHECK: Only in {{.*}}dir2: extrafile
+# CHECK: error: command failed with exit status: 1
+
+# CHECK: FAIL: shtest-shell :: diff-r-error-3.txt
+# CHECK: *** TEST 'shtest-shell :: diff-r-error-3.txt' FAILED ***
+# CEHCK: $ "diff" "-r"
+# CHECK: # command output:
+# CHECK: Only in {{.*}}dir1: extra_subdir
+# CHECK: error: command failed with exit status: 1
+
+# CHECK: FAIL: shtest-shell :: diff-r-error-4.txt
+# CHECK: *** TEST 'shtest-shell :: diff-r-error-4.txt' FAILED ***
+# CEHCK: $ "diff" "-r"
+# CHECK: # command output:
+# CHECK: File {{.*}}dir1{{.*}}extra_subdir is a directory while file {{.*}}dir2{{.*}}extra_subdir is a regular file
+# CHECK: error: command failed with exit status: 1
+
+# CHECK: FAIL: shtest-shell :: diff-r-error-5.txt
+# CHECK: *** TEST 'shtest-shell :: diff-r-error-5.txt' FAILED ***
+# CEHCK: $ "diff" "-r"
+# CHECK: # command output:
+# CHECK: Only in {{.*}}dir1: extra_subdir
+# CHECK: error: command failed with exit status: 1
+
+# CHECK: FAIL: shtest-shell :: diff-r-error-6.txt
+# CHECK: *** TEST 'shtest-shell :: diff-r-error-6.txt' FAILED ***
+# CEHCK: $ "diff" "-r"
+# CHECK: # command output:
+# CHECK: File {{.*}}dir1{{.*}}extra_file is a regular empty file while file {{.*}}dir2{{.*}}extra_file is a directory
+# CHECK: error: command failed with exit status: 1
+
+# CHECK: PASS: shtest-shell :: diff-r.txt
+
# CHECK: FAIL: shtest-shell :: error-0.txt
# CHECK: *** TEST 'shtest-shell :: error-0.txt' FAILED ***
# CHECK: $ "not-a-real-command"
@@ -149,4 +204,4 @@
# CHECK: PASS: shtest-shell :: sequencing-0.txt
# CHECK: XFAIL: shtest-shell :: sequencing-1.txt
# CHECK: PASS: shtest-shell :: valid-shell.txt
-# CHECK: Failing Tests (17)
+# CHECK: Failing Tests (24)
OpenPOWER on IntegriCloud