summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2018-08-11 12:12:39 +0000
committerChristos Zoulas <christos@zoulas.com>2018-08-11 12:12:39 +0000
commita0785d309b67bc4ad4e978ae6e10d22818461856 (patch)
tree1b5d4369653695168aaf54d87ce3872392fe709b /tests
parent7a0333eb2fd92c252919b35b0a30ed816a96c6e5 (diff)
downloadfile-git-a0785d309b67bc4ad4e978ae6e10d22818461856.tar.gz
Add more tests
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am80
-rw-r--r--tests/json1.result1
-rw-r--r--tests/json1.testfile14
-rw-r--r--tests/json2.result1
-rw-r--r--tests/json2.testfile22
-rw-r--r--tests/json3.result1
-rw-r--r--tests/json3.testfile13
-rw-r--r--tests/regex-eol.magic6
-rw-r--r--tests/regex-eol.result1
-rw-r--r--tests/regex-eol.testfile24
10 files changed, 157 insertions, 6 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bcb5518d..e84ca136 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,18 +3,86 @@ test_LDADD = $(top_builddir)/src/libmagic.la
test_CPPFLAGS = -I$(top_builddir)/src
EXTRA_DIST = \
-escapevel.result \
+regex-eol.magic \
+CVE-2014-1943.testfile \
+JW07022A.mp3.testfile \
escapevel.testfile \
-gedcom.result \
+fit-map-data.testfile \
gedcom.testfile \
-hddrawcopytool.result \
hddrawcopytool.testfile \
-issue311docx.result \
issue311docx.testfile \
+issue359xlsx.testfile \
+json1.testfile \
+json2.testfile \
+json3.testfile \
+regex-eol.testfile \
+zstd-v0.2-FF.testfile \
+zstd-v0.3-FF.testfile \
+zstd-v0.4-FF.testfile \
+zstd-v0.5-FF.testfile \
+zstd-v0.6-FF.testfile \
+zstd-v0.7-21.testfile \
+zstd-v0.7-22.testfile \
+zstd-v0.8-01.testfile \
+zstd-v0.8-02.testfile \
+zstd-v0.8-03.testfile \
+zstd-v0.8-16.testfile \
+zstd-v0.8-20.testfile \
+zstd-v0.8-21.testfile \
+zstd-v0.8-22.testfile \
+zstd-v0.8-23.testfile \
+zstd-v0.8-F4.testfile \
+zstd-v0.8-FF.testfile \
+CVE-2014-1943.result \
JW07022A.mp3.result \
-JW07022A.mp3.testfile
+escapevel.result \
+fit-map-data.result \
+gedcom.result \
+hddrawcopytool.result \
+issue311docx.result \
+issue359xlsx.result \
+json1.result \
+json2.result \
+json3.result \
+regex-eol.result \
+zstd-3-skippable-frames.result \
+zstd-dictionary-0.result \
+zstd-dictionary-1.result \
+zstd-dictionary-2.result \
+zstd-skippable-frame-0.result \
+zstd-skippable-frame-4.result \
+zstd-skippable-frame-8.result \
+zstd-skippable-frame-C.result \
+zstd-v0.2-FF.result \
+zstd-v0.3-FF.result \
+zstd-v0.4-FF.result \
+zstd-v0.5-FF.result \
+zstd-v0.6-FF.result \
+zstd-v0.7-00.result \
+zstd-v0.7-21.result \
+zstd-v0.7-22.result \
+zstd-v0.8-00.result \
+zstd-v0.8-01.result \
+zstd-v0.8-02.result \
+zstd-v0.8-03.result \
+zstd-v0.8-16.result \
+zstd-v0.8-20.result \
+zstd-v0.8-21.result \
+zstd-v0.8-22.result \
+zstd-v0.8-23.result \
+zstd-v0.8-F4.result \
+zstd-v0.8-FF.result
T = $(top_srcdir)/tests
check-local:
MAGIC=$(top_builddir)/magic/magic ./test
- set -e; for i in $T/*.testfile; do echo Running test: $$i; TZ=UTC MAGIC=$(top_builddir)/magic/magic ./test $$i $${i%%.testfile}.result; done
+ set -e; \
+ for i in $T/*.testfile; do \
+ echo Running test: $$i; \
+ if [ -f $${i%%.testfile}.magic ]; then \
+ m=$${i%%.testfile}.magic; \
+ else \
+ m=$(top_builddir)/magic/magic; \
+ fi; \
+ TZ=UTC MAGIC=$$m ./test $$i $${i%%.testfile}.result; \
+ done
diff --git a/tests/json1.result b/tests/json1.result
new file mode 100644
index 00000000..01442dc9
--- /dev/null
+++ b/tests/json1.result
@@ -0,0 +1 @@
+JSON data \ No newline at end of file
diff --git a/tests/json1.testfile b/tests/json1.testfile
new file mode 100644
index 00000000..3fb57609
--- /dev/null
+++ b/tests/json1.testfile
@@ -0,0 +1,14 @@
+ {
+ "Image": {
+ "Width": 800,
+ "Height": 600,
+ "Title": "View from 15th Floor",
+ "Thumbnail": {
+ "Url": "http://www.example.com/image/481989943",
+ "Height": 125,
+ "Width": 100
+ },
+ "Animated" : false,
+ "IDs": [116, 943, 234, 38793]
+ }
+ }
diff --git a/tests/json2.result b/tests/json2.result
new file mode 100644
index 00000000..01442dc9
--- /dev/null
+++ b/tests/json2.result
@@ -0,0 +1 @@
+JSON data \ No newline at end of file
diff --git a/tests/json2.testfile b/tests/json2.testfile
new file mode 100644
index 00000000..669007a2
--- /dev/null
+++ b/tests/json2.testfile
@@ -0,0 +1,22 @@
+ [
+ {
+ "precision": "zip",
+ "Latitude": 37.7668,
+ "Longitude": -122.3959,
+ "Address": "",
+ "City": "SAN FRANCISCO",
+ "State": "CA",
+ "Zip": "94107",
+ "Country": "US"
+ },
+ {
+ "precision": "zip",
+ "Latitude": 37.371991,
+ "Longitude": -122.026020,
+ "Address": "",
+ "City": "SUNNYVALE",
+ "State": "CA",
+ "Zip": "94085",
+ "Country": "US"
+ }
+ ]
diff --git a/tests/json3.result b/tests/json3.result
new file mode 100644
index 00000000..01442dc9
--- /dev/null
+++ b/tests/json3.result
@@ -0,0 +1 @@
+JSON data \ No newline at end of file
diff --git a/tests/json3.testfile b/tests/json3.testfile
new file mode 100644
index 00000000..9f31ac1c
--- /dev/null
+++ b/tests/json3.testfile
@@ -0,0 +1,13 @@
+{
+ "abc": "edf",
+ "json": "crab",
+ "ololo": [
+ 1,
+ 2,
+ 3
+ ],
+ "subcrab": {
+ "name": "crab",
+ "surname": "subcrab"
+ }
+}
diff --git a/tests/regex-eol.magic b/tests/regex-eol.magic
new file mode 100644
index 00000000..883d74c9
--- /dev/null
+++ b/tests/regex-eol.magic
@@ -0,0 +1,6 @@
+## Ansible Vault files
+0 string $ANSIBLE_VAULT Ansible Vault text
+>&1 regex/1l [0-9]+(\.[0-9]+)+ \b, version %s
+>>&1 regex/1l [^;]+$ \b, using %s encryption
+!:mime application/ansible-vault
+!:strength +60
diff --git a/tests/regex-eol.result b/tests/regex-eol.result
new file mode 100644
index 00000000..5b1a7dbb
--- /dev/null
+++ b/tests/regex-eol.result
@@ -0,0 +1 @@
+Ansible Vault text, version 1.1, using AES256 encryption \ No newline at end of file
diff --git a/tests/regex-eol.testfile b/tests/regex-eol.testfile
new file mode 100644
index 00000000..607a8524
--- /dev/null
+++ b/tests/regex-eol.testfile
@@ -0,0 +1,24 @@
+$ANSIBLE_VAULT;1.1;AES256
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000