diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:52:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:52:51 +0000 |
commit | 71507ca5d2410b11889ca963fafcd1bcad5044c3 (patch) | |
tree | 17e6d07243d49e29e4b75887e0d07f24ec2b66e8 /tests | |
parent | Initial commit. (diff) | |
download | file-71507ca5d2410b11889ca963fafcd1bcad5044c3.tar.xz file-71507ca5d2410b11889ca963fafcd1bcad5044c3.zip |
Adding upstream version 1:5.44.upstream/1%5.44upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests')
148 files changed, 1344 insertions, 0 deletions
diff --git a/tests/CVE-2014-1943.result b/tests/CVE-2014-1943.result new file mode 100644 index 0000000..1b31457 --- /dev/null +++ b/tests/CVE-2014-1943.result @@ -0,0 +1 @@ +Apple Driver Map, blocksize 0 diff --git a/tests/CVE-2014-1943.testfile b/tests/CVE-2014-1943.testfile Binary files differnew file mode 100644 index 0000000..3fc252b --- /dev/null +++ b/tests/CVE-2014-1943.testfile diff --git a/tests/JW07022A.mp3.result b/tests/JW07022A.mp3.result new file mode 100644 index 0000000..fe4dd36 --- /dev/null +++ b/tests/JW07022A.mp3.result @@ -0,0 +1 @@ +Audio file with ID3 version 2.2.0, contains: MPEG ADTS, layer III, v1, 96 kbps, 44.1 kHz, Monaural diff --git a/tests/JW07022A.mp3.testfile b/tests/JW07022A.mp3.testfile Binary files differnew file mode 100644 index 0000000..8b0a577 --- /dev/null +++ b/tests/JW07022A.mp3.testfile diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..03dc645 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,176 @@ +check_PROGRAMS = test +test_LDADD = $(top_builddir)/src/libmagic.la +test_CPPFLAGS = -I$(top_builddir)/src + +EXTRA_DIST = \ +android-vdex-1.result \ +android-vdex-1.testfile \ +android-vdex-2.result \ +android-vdex-2.testfile \ +arj.result \ +arj.testfile \ +CVE-2014-1943.result \ +CVE-2014-1943.testfile \ +JW07022A.mp3.result \ +JW07022A.mp3.testfile \ +bcachefs.result \ +bcachefs.testfile \ +cl8m8ocofedso.result \ +cl8m8ocofedso.testfile \ +cmd1.testfile \ +cmd1.result \ +cmd2.testfile \ +cmd2.result \ +cmd3.testfile \ +cmd3.result \ +cmd4.testfile \ +cmd4.result \ +dsd64-dff.result \ +dsd64-dff.testfile \ +dsd64-dsf.result \ +dsd64-dsf.testfile \ +escapevel.result \ +escapevel.testfile \ +ext4.result \ +ext4.testfile \ +fit-map-data.result \ +fit-map-data.testfile \ +gedcom.result \ +gedcom.testfile \ +gpkg-1-zst.result \ +gpkg-1-zst.testfile \ +hddrawcopytool.result \ +hddrawcopytool.testfile \ +issue311docx.result \ +issue311docx.testfile \ +issue359xlsx.result \ +issue359xlsx.testfile \ +jpeg-text.result \ +jpeg-text.testfile \ +json1.result \ +json1.testfile \ +json2.result \ +json2.testfile \ +json3.result \ +json3.testfile \ +json4.result \ +json4.testfile \ +json5.result \ +json5.testfile \ +json6.result \ +json6.testfile \ +json7.result \ +json7.testfile \ +json8.result \ +json8.testfile \ +jsonlines1.testfile \ +jsonlines1.result \ +matilde.arm.result \ +matilde.arm.testfile \ +multiple-A.magic \ +multiple-B.magic \ +multiple.flags \ +multiple.result \ +multiple.testfile \ +pcjr.result \ +pcjr.testfile \ +pgp-binary-key-v2-phil.result \ +pgp-binary-key-v2-phil.testfile \ +pgp-binary-key-v3-lutz.result \ +pgp-binary-key-v3-lutz.testfile \ +pgp-binary-key-v4-dsa.result \ +pgp-binary-key-v4-dsa.testfile \ +pgp-binary-key-v4-ecc-no-userid-secret.result \ +pgp-binary-key-v4-ecc-no-userid-secret.testfile \ +pgp-binary-key-v4-ecc-secret-key.result \ +pgp-binary-key-v4-ecc-secret-key.testfile \ +pgp-binary-key-v4-rsa-key.result \ +pgp-binary-key-v4-rsa-key.testfile \ +pgp-binary-key-v4-rsa-no-userid-secret.result \ +pgp-binary-key-v4-rsa-no-userid-secret.testfile \ +pgp-binary-key-v4-rsa-secret-key.result \ +pgp-binary-key-v4-rsa-secret-key.testfile \ +pnm1.result \ +pnm1.testfile \ +pnm2.result \ +pnm2.testfile \ +pnm3.result \ +pnm3.testfile \ +regex-eol.magic \ +regex-eol.result \ +regex-eol.testfile \ +uf2.result \ +uf2.testfile \ +xclbin.result \ +xclbin.testfile \ +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.2-FF.testfile \ +zstd-v0.3-FF.result \ +zstd-v0.3-FF.testfile \ +zstd-v0.4-FF.result \ +zstd-v0.4-FF.testfile \ +zstd-v0.5-FF.result \ +zstd-v0.5-FF.testfile \ +zstd-v0.6-FF.result \ +zstd-v0.6-FF.testfile \ +zstd-v0.7-00.result \ +zstd-v0.7-21.result \ +zstd-v0.7-21.testfile \ +zstd-v0.7-22.result \ +zstd-v0.7-22.testfile \ +zstd-v0.8-00.result \ +zstd-v0.8-01.result \ +zstd-v0.8-01.testfile \ +zstd-v0.8-02.result \ +zstd-v0.8-02.testfile \ +zstd-v0.8-03.result \ +zstd-v0.8-03.testfile \ +zstd-v0.8-16.result \ +zstd-v0.8-16.testfile \ +zstd-v0.8-20.result \ +zstd-v0.8-20.testfile \ +zstd-v0.8-21.result \ +zstd-v0.8-21.testfile \ +zstd-v0.8-22.result \ +zstd-v0.8-22.testfile \ +zstd-v0.8-23.result \ +zstd-v0.8-23.testfile \ +zstd-v0.8-F4.result \ +zstd-v0.8-F4.testfile \ +zstd-v0.8-FF.result \ +zstd-v0.8-FF.testfile + +T = $(top_srcdir)/tests +check-local: + set -e; \ + for i in $T/*.testfile; do \ + t=$${i%%.testfile}; \ + echo Running test: $$t; \ + m=; \ + for j in $$(eval echo $${t}\*.magic); do \ + if [ -f "$$j" ]; then \ + if [ -z "$$m" ]; then \ + m=$$j; \ + else \ + m=$$m:$$j; \ + fi \ + fi \ + done; \ + if [ -z "$$m" ]; then \ + m=$(top_builddir)/magic/magic; \ + fi; \ + f=-e; \ + if [ -f $${t}.flags ]; then \ + f=$$f$$(cat $${t}.flags); \ + fi; \ + echo TZ=UTC MAGIC=$$m ./test $$f $$i $${t}.result; \ + TZ=UTC MAGIC=$$m ./test $$f $$i $${t}.result; \ + done diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..230b5a3 --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,787 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = test$(EXEEXT) +subdir = tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +test_SOURCES = test.c +test_OBJECTS = test-test.$(OBJEXT) +test_DEPENDENCIES = $(top_builddir)/src/libmagic.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/test-test.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = test.c +DIST_SOURCES = test.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp README +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +pkgdatadir = @pkgdatadir@ +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CFLAG_VISIBILITY = @CFLAG_VISIBILITY@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_VISIBILITY = @HAVE_VISIBILITY@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MINGW = @MINGW@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WARNINGS = @WARNINGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +fsect = @fsect@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +test_LDADD = $(top_builddir)/src/libmagic.la +test_CPPFLAGS = -I$(top_builddir)/src +EXTRA_DIST = \ +android-vdex-1.result \ +android-vdex-1.testfile \ +android-vdex-2.result \ +android-vdex-2.testfile \ +arj.result \ +arj.testfile \ +CVE-2014-1943.result \ +CVE-2014-1943.testfile \ +JW07022A.mp3.result \ +JW07022A.mp3.testfile \ +bcachefs.result \ +bcachefs.testfile \ +cl8m8ocofedso.result \ +cl8m8ocofedso.testfile \ +cmd1.testfile \ +cmd1.result \ +cmd2.testfile \ +cmd2.result \ +cmd3.testfile \ +cmd3.result \ +cmd4.testfile \ +cmd4.result \ +dsd64-dff.result \ +dsd64-dff.testfile \ +dsd64-dsf.result \ +dsd64-dsf.testfile \ +escapevel.result \ +escapevel.testfile \ +ext4.result \ +ext4.testfile \ +fit-map-data.result \ +fit-map-data.testfile \ +gedcom.result \ +gedcom.testfile \ +gpkg-1-zst.result \ +gpkg-1-zst.testfile \ +hddrawcopytool.result \ +hddrawcopytool.testfile \ +issue311docx.result \ +issue311docx.testfile \ +issue359xlsx.result \ +issue359xlsx.testfile \ +jpeg-text.result \ +jpeg-text.testfile \ +json1.result \ +json1.testfile \ +json2.result \ +json2.testfile \ +json3.result \ +json3.testfile \ +json4.result \ +json4.testfile \ +json5.result \ +json5.testfile \ +json6.result \ +json6.testfile \ +json7.result \ +json7.testfile \ +json8.result \ +json8.testfile \ +jsonlines1.testfile \ +jsonlines1.result \ +matilde.arm.result \ +matilde.arm.testfile \ +multiple-A.magic \ +multiple-B.magic \ +multiple.flags \ +multiple.result \ +multiple.testfile \ +pcjr.result \ +pcjr.testfile \ +pgp-binary-key-v2-phil.result \ +pgp-binary-key-v2-phil.testfile \ +pgp-binary-key-v3-lutz.result \ +pgp-binary-key-v3-lutz.testfile \ +pgp-binary-key-v4-dsa.result \ +pgp-binary-key-v4-dsa.testfile \ +pgp-binary-key-v4-ecc-no-userid-secret.result \ +pgp-binary-key-v4-ecc-no-userid-secret.testfile \ +pgp-binary-key-v4-ecc-secret-key.result \ +pgp-binary-key-v4-ecc-secret-key.testfile \ +pgp-binary-key-v4-rsa-key.result \ +pgp-binary-key-v4-rsa-key.testfile \ +pgp-binary-key-v4-rsa-no-userid-secret.result \ +pgp-binary-key-v4-rsa-no-userid-secret.testfile \ +pgp-binary-key-v4-rsa-secret-key.result \ +pgp-binary-key-v4-rsa-secret-key.testfile \ +pnm1.result \ +pnm1.testfile \ +pnm2.result \ +pnm2.testfile \ +pnm3.result \ +pnm3.testfile \ +regex-eol.magic \ +regex-eol.result \ +regex-eol.testfile \ +uf2.result \ +uf2.testfile \ +xclbin.result \ +xclbin.testfile \ +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.2-FF.testfile \ +zstd-v0.3-FF.result \ +zstd-v0.3-FF.testfile \ +zstd-v0.4-FF.result \ +zstd-v0.4-FF.testfile \ +zstd-v0.5-FF.result \ +zstd-v0.5-FF.testfile \ +zstd-v0.6-FF.result \ +zstd-v0.6-FF.testfile \ +zstd-v0.7-00.result \ +zstd-v0.7-21.result \ +zstd-v0.7-21.testfile \ +zstd-v0.7-22.result \ +zstd-v0.7-22.testfile \ +zstd-v0.8-00.result \ +zstd-v0.8-01.result \ +zstd-v0.8-01.testfile \ +zstd-v0.8-02.result \ +zstd-v0.8-02.testfile \ +zstd-v0.8-03.result \ +zstd-v0.8-03.testfile \ +zstd-v0.8-16.result \ +zstd-v0.8-16.testfile \ +zstd-v0.8-20.result \ +zstd-v0.8-20.testfile \ +zstd-v0.8-21.result \ +zstd-v0.8-21.testfile \ +zstd-v0.8-22.result \ +zstd-v0.8-22.testfile \ +zstd-v0.8-23.result \ +zstd-v0.8-23.testfile \ +zstd-v0.8-F4.result \ +zstd-v0.8-F4.testfile \ +zstd-v0.8-FF.result \ +zstd-v0.8-FF.testfile + +T = $(top_srcdir)/tests +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) $(EXTRA_test_DEPENDENCIES) + @rm -f test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_OBJECTS) $(test_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-test.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +test-test.o: test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test-test.o -MD -MP -MF $(DEPDIR)/test-test.Tpo -c -o test-test.o `test -f 'test.c' || echo '$(srcdir)/'`test.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test-test.Tpo $(DEPDIR)/test-test.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test.c' object='test-test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test-test.o `test -f 'test.c' || echo '$(srcdir)/'`test.c + +test-test.obj: test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test-test.obj -MD -MP -MF $(DEPDIR)/test-test.Tpo -c -o test-test.obj `if test -f 'test.c'; then $(CYGPATH_W) 'test.c'; else $(CYGPATH_W) '$(srcdir)/test.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test-test.Tpo $(DEPDIR)/test-test.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test.c' object='test-test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test-test.obj `if test -f 'test.c'; then $(CYGPATH_W) 'test.c'; else $(CYGPATH_W) '$(srcdir)/test.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/test-test.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/test-test.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am \ + check-local clean clean-checkPROGRAMS clean-generic \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + +check-local: + set -e; \ + for i in $T/*.testfile; do \ + t=$${i%%.testfile}; \ + echo Running test: $$t; \ + m=; \ + for j in $$(eval echo $${t}\*.magic); do \ + if [ -f "$$j" ]; then \ + if [ -z "$$m" ]; then \ + m=$$j; \ + else \ + m=$$m:$$j; \ + fi \ + fi \ + done; \ + if [ -z "$$m" ]; then \ + m=$(top_builddir)/magic/magic; \ + fi; \ + f=-e; \ + if [ -f $${t}.flags ]; then \ + f=$$f$$(cat $${t}.flags); \ + fi; \ + echo TZ=UTC MAGIC=$$m ./test $$f $$i $${t}.result; \ + TZ=UTC MAGIC=$$m ./test $$f $$i $${t}.result; \ + done + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/README b/tests/README new file mode 100644 index 0000000..5826773 --- /dev/null +++ b/tests/README @@ -0,0 +1,14 @@ +file tests +========== + +This directory contains tests for file. It is highly encouraged to add +one each time a bug is found, and each time new magic is added. Each +test consists of two files: + + TEST.testfile + TEST.result + +where TEST is the base name of the test, TEST.testfile is the input, +and TEST.result is the desired output from file. + +To add a new test just add the test files to the directory. diff --git a/tests/android-vdex-1.result b/tests/android-vdex-1.result new file mode 100644 index 0000000..8ca5654 --- /dev/null +++ b/tests/android-vdex-1.result @@ -0,0 +1 @@ +Android vdex file, verifier deps version: 021, dex section version: 002, number of dex files: 4, verifier deps size: 106328 diff --git a/tests/android-vdex-1.testfile b/tests/android-vdex-1.testfile Binary files differnew file mode 100644 index 0000000..25f4f06 --- /dev/null +++ b/tests/android-vdex-1.testfile diff --git a/tests/android-vdex-2.result b/tests/android-vdex-2.result new file mode 100644 index 0000000..6fb0236 --- /dev/null +++ b/tests/android-vdex-2.result @@ -0,0 +1 @@ +Android vdex file, being processed by dex2oat, verifier deps version: 019, dex section version: 002, number of dex files: 1, verifier deps size: 1016 diff --git a/tests/android-vdex-2.testfile b/tests/android-vdex-2.testfile Binary files differnew file mode 100644 index 0000000..7e7761d --- /dev/null +++ b/tests/android-vdex-2.testfile diff --git a/tests/arj.result b/tests/arj.result new file mode 100644 index 0000000..7198be2 --- /dev/null +++ b/tests/arj.result @@ -0,0 +1 @@ +ARJ archive data, v11, slash-switched, created 5 1980+48, original name: example_m0.arj, os: Unix diff --git a/tests/arj.testfile b/tests/arj.testfile Binary files differnew file mode 100644 index 0000000..e133f8a --- /dev/null +++ b/tests/arj.testfile diff --git a/tests/bcachefs.result b/tests/bcachefs.result new file mode 100644 index 0000000..83d37ea --- /dev/null +++ b/tests/bcachefs.result @@ -0,0 +1 @@ +bcachefs, UUID=46bd306f-80ad-4cd0-af4f-147e7d85f393, label "Label", version 13, min version 13, device 0/UUID=72a60ede-4cb6-4374-aa70-cb38a50af5ef, 1 devices diff --git a/tests/bcachefs.testfile b/tests/bcachefs.testfile Binary files differnew file mode 100644 index 0000000..4e8a394 --- /dev/null +++ b/tests/bcachefs.testfile diff --git a/tests/cl8m8ocofedso.result b/tests/cl8m8ocofedso.result new file mode 100644 index 0000000..e1dd3b1 --- /dev/null +++ b/tests/cl8m8ocofedso.result @@ -0,0 +1 @@ +Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1, 192 kbps, 44.1 kHz, JntStereo diff --git a/tests/cl8m8ocofedso.testfile b/tests/cl8m8ocofedso.testfile Binary files differnew file mode 100644 index 0000000..4b1651b --- /dev/null +++ b/tests/cl8m8ocofedso.testfile diff --git a/tests/cmd1.result b/tests/cmd1.result new file mode 100644 index 0000000..d77043f --- /dev/null +++ b/tests/cmd1.result @@ -0,0 +1 @@ +a /usr/bin/cmd1 script, ASCII text executable diff --git a/tests/cmd1.testfile b/tests/cmd1.testfile new file mode 100644 index 0000000..8277edf --- /dev/null +++ b/tests/cmd1.testfile @@ -0,0 +1 @@ +#! /usr/bin/cmd1 diff --git a/tests/cmd2.result b/tests/cmd2.result new file mode 100644 index 0000000..77627c3 --- /dev/null +++ b/tests/cmd2.result @@ -0,0 +1 @@ +a /usr/bin/cmd2 script, ASCII text executable diff --git a/tests/cmd2.testfile b/tests/cmd2.testfile new file mode 100644 index 0000000..104a017 --- /dev/null +++ b/tests/cmd2.testfile @@ -0,0 +1 @@ +#!/usr/bin/cmd2 diff --git a/tests/cmd3.result b/tests/cmd3.result new file mode 100644 index 0000000..2d100e0 --- /dev/null +++ b/tests/cmd3.result @@ -0,0 +1 @@ +a /usr/bin/cmd3 script executable (binary data) diff --git a/tests/cmd3.testfile b/tests/cmd3.testfile new file mode 100644 index 0000000..8287aca --- /dev/null +++ b/tests/cmd3.testfile @@ -0,0 +1,2 @@ +#!/usr/bin/cmd3 + diff --git a/tests/cmd4.result b/tests/cmd4.result new file mode 100644 index 0000000..af635a4 --- /dev/null +++ b/tests/cmd4.result @@ -0,0 +1 @@ +a /usr/bin/cmd4 script executable (binary data) diff --git a/tests/cmd4.testfile b/tests/cmd4.testfile new file mode 100644 index 0000000..529053e --- /dev/null +++ b/tests/cmd4.testfile @@ -0,0 +1,2 @@ +#! /usr/bin/cmd4 + diff --git a/tests/dsd64-dff.result b/tests/dsd64-dff.result new file mode 100644 index 0000000..bf60967 --- /dev/null +++ b/tests/dsd64-dff.result @@ -0,0 +1 @@ +DSDIFF audio bitstream data, 1 bit, mono, "DSD 64" 2822400 Hz, no compression, ID3 version 2.0.0 diff --git a/tests/dsd64-dff.testfile b/tests/dsd64-dff.testfile Binary files differnew file mode 100644 index 0000000..b5aba62 --- /dev/null +++ b/tests/dsd64-dff.testfile diff --git a/tests/dsd64-dsf.result b/tests/dsd64-dsf.result new file mode 100644 index 0000000..a0d5f75 --- /dev/null +++ b/tests/dsd64-dsf.result @@ -0,0 +1 @@ +DSF audio bitstream data, 1 bit, mono, "DSD 64" 2822400 Hz, no compression, ID3 version 2.3.0 diff --git a/tests/dsd64-dsf.testfile b/tests/dsd64-dsf.testfile Binary files differnew file mode 100644 index 0000000..a1d106d --- /dev/null +++ b/tests/dsd64-dsf.testfile diff --git a/tests/escapevel.result b/tests/escapevel.result new file mode 100644 index 0000000..163f991 --- /dev/null +++ b/tests/escapevel.result @@ -0,0 +1 @@ +Zip data (MIME type "application/vnd.nz.gen.geek_central.ti5x"?) diff --git a/tests/escapevel.testfile b/tests/escapevel.testfile Binary files differnew file mode 100644 index 0000000..2857260 --- /dev/null +++ b/tests/escapevel.testfile diff --git a/tests/ext4.result b/tests/ext4.result new file mode 100644 index 0000000..4e9657c --- /dev/null +++ b/tests/ext4.result @@ -0,0 +1 @@ +Linux rev 1.0 ext4 filesystem data, UUID=d32bbb08-3a76-4510-a064-3045f887dbdf (extents) (64bit) (large files) (huge files) diff --git a/tests/ext4.testfile b/tests/ext4.testfile Binary files differnew file mode 100644 index 0000000..6add6b9 --- /dev/null +++ b/tests/ext4.testfile diff --git a/tests/fit-map-data.result b/tests/fit-map-data.result new file mode 100644 index 0000000..5d97617 --- /dev/null +++ b/tests/fit-map-data.result @@ -0,0 +1 @@ +FIT Map data, unit id 65536, serial 3879446968, Sat May 31 10:00:34 2014, manufacturer 1 (garmin), product 1632, type 4 (Activity) diff --git a/tests/fit-map-data.testfile b/tests/fit-map-data.testfile Binary files differnew file mode 100644 index 0000000..4f1d46a --- /dev/null +++ b/tests/fit-map-data.testfile diff --git a/tests/gedcom.result b/tests/gedcom.result new file mode 100644 index 0000000..bcd1176 --- /dev/null +++ b/tests/gedcom.result @@ -0,0 +1 @@ +GEDCOM genealogy text version 5.5, ASCII text diff --git a/tests/gedcom.testfile b/tests/gedcom.testfile new file mode 100644 index 0000000..3d9607e --- /dev/null +++ b/tests/gedcom.testfile @@ -0,0 +1,8 @@ +0 HEAD +1 SOUR GENJ +2 VERS 2.x +1 GEDC +2 VERS 5.5 +2 FORM Lineage-Linked +1 CHAR UNICODE +1 LANG Italian diff --git a/tests/gpkg-1-zst.result b/tests/gpkg-1-zst.result new file mode 100644 index 0000000..e991494 --- /dev/null +++ b/tests/gpkg-1-zst.result @@ -0,0 +1 @@ +Gentoo GLEP 78 (GPKG) binary package for "inkscape-1.2.1-r2-1" using zstd compression diff --git a/tests/gpkg-1-zst.testfile b/tests/gpkg-1-zst.testfile Binary files differnew file mode 100644 index 0000000..00c71c0 --- /dev/null +++ b/tests/gpkg-1-zst.testfile diff --git a/tests/hddrawcopytool.result b/tests/hddrawcopytool.result new file mode 100644 index 0000000..53d8ad0 --- /dev/null +++ b/tests/hddrawcopytool.result @@ -0,0 +1 @@ +HDD Raw Copy Tool 1.10 - HD model: ST500DM0 02-1BD142 serial: 51D20233A7C0 diff --git a/tests/hddrawcopytool.testfile b/tests/hddrawcopytool.testfile Binary files differnew file mode 100644 index 0000000..36ad7c6 --- /dev/null +++ b/tests/hddrawcopytool.testfile diff --git a/tests/issue311docx.result b/tests/issue311docx.result new file mode 100644 index 0000000..816a4bc --- /dev/null +++ b/tests/issue311docx.result @@ -0,0 +1 @@ +Microsoft Word 2007+ diff --git a/tests/issue311docx.testfile b/tests/issue311docx.testfile Binary files differnew file mode 100644 index 0000000..e4328ec --- /dev/null +++ b/tests/issue311docx.testfile diff --git a/tests/issue359xlsx.result b/tests/issue359xlsx.result new file mode 100644 index 0000000..6507696 --- /dev/null +++ b/tests/issue359xlsx.result @@ -0,0 +1 @@ +Microsoft Excel 2007+ diff --git a/tests/issue359xlsx.testfile b/tests/issue359xlsx.testfile Binary files differnew file mode 100644 index 0000000..9d751c4 --- /dev/null +++ b/tests/issue359xlsx.testfile diff --git a/tests/jpeg-text.result b/tests/jpeg-text.result new file mode 100644 index 0000000..c35c5b7 --- /dev/null +++ b/tests/jpeg-text.result @@ -0,0 +1 @@ +ASCII text, with no line terminators diff --git a/tests/jpeg-text.testfile b/tests/jpeg-text.testfile new file mode 100644 index 0000000..fe119bd --- /dev/null +++ b/tests/jpeg-text.testfile @@ -0,0 +1 @@ +/*! jP
\ No newline at end of file diff --git a/tests/json1.result b/tests/json1.result new file mode 100644 index 0000000..7d63524 --- /dev/null +++ b/tests/json1.result @@ -0,0 +1 @@ +JSON text data diff --git a/tests/json1.testfile b/tests/json1.testfile new file mode 100644 index 0000000..3fb5760 --- /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 0000000..7d63524 --- /dev/null +++ b/tests/json2.result @@ -0,0 +1 @@ +JSON text data diff --git a/tests/json2.testfile b/tests/json2.testfile new file mode 100644 index 0000000..669007a --- /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 0000000..7d63524 --- /dev/null +++ b/tests/json3.result @@ -0,0 +1 @@ +JSON text data diff --git a/tests/json3.testfile b/tests/json3.testfile new file mode 100644 index 0000000..9f31ac1 --- /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/json4.result b/tests/json4.result new file mode 100644 index 0000000..7d63524 --- /dev/null +++ b/tests/json4.result @@ -0,0 +1 @@ +JSON text data diff --git a/tests/json4.testfile b/tests/json4.testfile new file mode 100644 index 0000000..7660873 --- /dev/null +++ b/tests/json4.testfile @@ -0,0 +1 @@ +[1] diff --git a/tests/json5.result b/tests/json5.result new file mode 100644 index 0000000..6f505ff --- /dev/null +++ b/tests/json5.result @@ -0,0 +1 @@ +ASCII text diff --git a/tests/json5.testfile b/tests/json5.testfile new file mode 100644 index 0000000..01bd52f --- /dev/null +++ b/tests/json5.testfile @@ -0,0 +1 @@ +[1] 2 diff --git a/tests/json6.result b/tests/json6.result new file mode 100644 index 0000000..7d63524 --- /dev/null +++ b/tests/json6.result @@ -0,0 +1 @@ +JSON text data diff --git a/tests/json6.testfile b/tests/json6.testfile new file mode 100644 index 0000000..db310f3 --- /dev/null +++ b/tests/json6.testfile @@ -0,0 +1 @@ +{"a":[ ]} diff --git a/tests/json7.result b/tests/json7.result new file mode 100644 index 0000000..6f505ff --- /dev/null +++ b/tests/json7.result @@ -0,0 +1 @@ +ASCII text diff --git a/tests/json7.testfile b/tests/json7.testfile new file mode 100644 index 0000000..cc723b0 --- /dev/null +++ b/tests/json7.testfile @@ -0,0 +1 @@ +{"tag": tLue} diff --git a/tests/json8.result b/tests/json8.result new file mode 100644 index 0000000..7d63524 --- /dev/null +++ b/tests/json8.result @@ -0,0 +1 @@ +JSON text data diff --git a/tests/json8.testfile b/tests/json8.testfile new file mode 100644 index 0000000..5114526 --- /dev/null +++ b/tests/json8.testfile @@ -0,0 +1 @@ +{"tag": true} diff --git a/tests/jsonlines1.result b/tests/jsonlines1.result new file mode 100644 index 0000000..7eb1ba0 --- /dev/null +++ b/tests/jsonlines1.result @@ -0,0 +1 @@ +New Line Delimited JSON text data diff --git a/tests/jsonlines1.testfile b/tests/jsonlines1.testfile new file mode 100644 index 0000000..9b47441 --- /dev/null +++ b/tests/jsonlines1.testfile @@ -0,0 +1,2 @@ +{} +{} diff --git a/tests/matilde.arm.result b/tests/matilde.arm.result new file mode 100644 index 0000000..66aeaad --- /dev/null +++ b/tests/matilde.arm.result @@ -0,0 +1 @@ +Adaptive Multi-Rate Codec (GSM telephony) diff --git a/tests/matilde.arm.testfile b/tests/matilde.arm.testfile Binary files differnew file mode 100644 index 0000000..56ffab1 --- /dev/null +++ b/tests/matilde.arm.testfile diff --git a/tests/multiple-A.magic b/tests/multiple-A.magic new file mode 100644 index 0000000..7709bb2 --- /dev/null +++ b/tests/multiple-A.magic @@ -0,0 +1,2 @@ +0 search {\\rt1 RTF1.0 +16 search ViVa2 Viva File 2.0 diff --git a/tests/multiple-B.magic b/tests/multiple-B.magic new file mode 100644 index 0000000..ccc452d --- /dev/null +++ b/tests/multiple-B.magic @@ -0,0 +1,2 @@ +6 search ABCD ABCD File +10 search TesT Test File 1.0 diff --git a/tests/multiple.flags b/tests/multiple.flags new file mode 100644 index 0000000..b68fde2 --- /dev/null +++ b/tests/multiple.flags @@ -0,0 +1 @@ +k diff --git a/tests/multiple.result b/tests/multiple.result new file mode 100644 index 0000000..8a8c5df --- /dev/null +++ b/tests/multiple.result @@ -0,0 +1 @@ +RTF1.0\012- Viva File 2.0\012- ABCD File\012- Test File 1.0, ASCII text, with no line terminators diff --git a/tests/multiple.testfile b/tests/multiple.testfile new file mode 100644 index 0000000..388979a --- /dev/null +++ b/tests/multiple.testfile @@ -0,0 +1 @@ +{\rt1 ABCDTesT xxViVa2
\ No newline at end of file diff --git a/tests/pcjr.result b/tests/pcjr.result new file mode 100644 index 0000000..92fcccb --- /dev/null +++ b/tests/pcjr.result @@ -0,0 +1 @@ +PCjr Cartridge image diff --git a/tests/pcjr.testfile b/tests/pcjr.testfile Binary files differnew file mode 100644 index 0000000..f8091d5 --- /dev/null +++ b/tests/pcjr.testfile diff --git a/tests/pgp-binary-key-v2-phil.result b/tests/pgp-binary-key-v2-phil.result new file mode 100644 index 0000000..ed50111 --- /dev/null +++ b/tests/pgp-binary-key-v2-phil.result @@ -0,0 +1 @@ +OpenPGP Public Key Version 2, Created Fri May 21 05:20:00 1993, RSA (Encrypt or Sign, 1024 bits); User ID; Signature; OpenPGP Certificate diff --git a/tests/pgp-binary-key-v2-phil.testfile b/tests/pgp-binary-key-v2-phil.testfile Binary files differnew file mode 100644 index 0000000..7c0952e --- /dev/null +++ b/tests/pgp-binary-key-v2-phil.testfile diff --git a/tests/pgp-binary-key-v3-lutz.result b/tests/pgp-binary-key-v3-lutz.result new file mode 100644 index 0000000..2bebc0b --- /dev/null +++ b/tests/pgp-binary-key-v3-lutz.result @@ -0,0 +1 @@ +OpenPGP Public Key Version 3, Created Mon Mar 17 11:14:30 1997, RSA (Encrypt or Sign, 1127 bits); User ID; Signature; OpenPGP Certificate diff --git a/tests/pgp-binary-key-v3-lutz.testfile b/tests/pgp-binary-key-v3-lutz.testfile Binary files differnew file mode 100644 index 0000000..90aa2dc --- /dev/null +++ b/tests/pgp-binary-key-v3-lutz.testfile diff --git a/tests/pgp-binary-key-v4-dsa.result b/tests/pgp-binary-key-v4-dsa.result new file mode 100644 index 0000000..f3341ea --- /dev/null +++ b/tests/pgp-binary-key-v4-dsa.result @@ -0,0 +1 @@ +OpenPGP Public Key Version 4, Created Mon Apr 7 22:23:01 1997, DSA (1024 bits); User ID; Signature; OpenPGP Certificate diff --git a/tests/pgp-binary-key-v4-dsa.testfile b/tests/pgp-binary-key-v4-dsa.testfile Binary files differnew file mode 100644 index 0000000..310efce --- /dev/null +++ b/tests/pgp-binary-key-v4-dsa.testfile diff --git a/tests/pgp-binary-key-v4-ecc-no-userid-secret.result b/tests/pgp-binary-key-v4-ecc-no-userid-secret.result new file mode 100644 index 0000000..54f274b --- /dev/null +++ b/tests/pgp-binary-key-v4-ecc-no-userid-secret.result @@ -0,0 +1 @@ +OpenPGP Secret Key Version 4, Created Wed Aug 26 20:52:13 2020, EdDSA; Signature; Secret Subkey; OpenPGP Certificate diff --git a/tests/pgp-binary-key-v4-ecc-no-userid-secret.testfile b/tests/pgp-binary-key-v4-ecc-no-userid-secret.testfile Binary files differnew file mode 100644 index 0000000..289a291 --- /dev/null +++ b/tests/pgp-binary-key-v4-ecc-no-userid-secret.testfile diff --git a/tests/pgp-binary-key-v4-ecc-secret-key.result b/tests/pgp-binary-key-v4-ecc-secret-key.result new file mode 100644 index 0000000..9fde23e --- /dev/null +++ b/tests/pgp-binary-key-v4-ecc-secret-key.result @@ -0,0 +1 @@ +OpenPGP Secret Key Version 4, Created Sat Aug 22 14:07:46 2020, EdDSA; User ID; Signature; OpenPGP Certificate diff --git a/tests/pgp-binary-key-v4-ecc-secret-key.testfile b/tests/pgp-binary-key-v4-ecc-secret-key.testfile Binary files differnew file mode 100644 index 0000000..f53f47a --- /dev/null +++ b/tests/pgp-binary-key-v4-ecc-secret-key.testfile diff --git a/tests/pgp-binary-key-v4-rsa-key.result b/tests/pgp-binary-key-v4-rsa-key.result new file mode 100644 index 0000000..ab9b81d --- /dev/null +++ b/tests/pgp-binary-key-v4-rsa-key.result @@ -0,0 +1 @@ +OpenPGP Secret Key Version 4, Created Sat Aug 22 14:05:57 2020, RSA (Encrypt or Sign, 3072 bits); User ID; Signature; OpenPGP Certificate diff --git a/tests/pgp-binary-key-v4-rsa-key.testfile b/tests/pgp-binary-key-v4-rsa-key.testfile Binary files differnew file mode 100644 index 0000000..7b70497 --- /dev/null +++ b/tests/pgp-binary-key-v4-rsa-key.testfile diff --git a/tests/pgp-binary-key-v4-rsa-no-userid-secret.result b/tests/pgp-binary-key-v4-rsa-no-userid-secret.result new file mode 100644 index 0000000..8fcf1cf --- /dev/null +++ b/tests/pgp-binary-key-v4-rsa-no-userid-secret.result @@ -0,0 +1 @@ +OpenPGP Secret Key Version 4, Created Sat Aug 22 20:13:52 2020, RSA (Encrypt or Sign, 3072 bits); Signature; Secret Subkey; OpenPGP Certificate diff --git a/tests/pgp-binary-key-v4-rsa-no-userid-secret.testfile b/tests/pgp-binary-key-v4-rsa-no-userid-secret.testfile Binary files differnew file mode 100644 index 0000000..7d5a7b4 --- /dev/null +++ b/tests/pgp-binary-key-v4-rsa-no-userid-secret.testfile diff --git a/tests/pgp-binary-key-v4-rsa-secret-key.result b/tests/pgp-binary-key-v4-rsa-secret-key.result new file mode 100644 index 0000000..ab9b81d --- /dev/null +++ b/tests/pgp-binary-key-v4-rsa-secret-key.result @@ -0,0 +1 @@ +OpenPGP Secret Key Version 4, Created Sat Aug 22 14:05:57 2020, RSA (Encrypt or Sign, 3072 bits); User ID; Signature; OpenPGP Certificate diff --git a/tests/pgp-binary-key-v4-rsa-secret-key.testfile b/tests/pgp-binary-key-v4-rsa-secret-key.testfile Binary files differnew file mode 100644 index 0000000..7b70497 --- /dev/null +++ b/tests/pgp-binary-key-v4-rsa-secret-key.testfile diff --git a/tests/pnm1.result b/tests/pnm1.result new file mode 100644 index 0000000..15d9e82 --- /dev/null +++ b/tests/pnm1.result @@ -0,0 +1 @@ +Netpbm image data, size = 2 x 2, greymap, ASCII text diff --git a/tests/pnm1.testfile b/tests/pnm1.testfile new file mode 100644 index 0000000..448108c --- /dev/null +++ b/tests/pnm1.testfile @@ -0,0 +1,5 @@ +P2 +2 +2 +255 +0 0 0 0 diff --git a/tests/pnm2.result b/tests/pnm2.result new file mode 100644 index 0000000..e1d9ec9 --- /dev/null +++ b/tests/pnm2.result @@ -0,0 +1 @@ +Netpbm image data, size = 2 x 2, rawbits, greymap diff --git a/tests/pnm2.testfile b/tests/pnm2.testfile Binary files differnew file mode 100644 index 0000000..baaeb2a --- /dev/null +++ b/tests/pnm2.testfile diff --git a/tests/pnm3.result b/tests/pnm3.result new file mode 100644 index 0000000..49b8000 --- /dev/null +++ b/tests/pnm3.result @@ -0,0 +1 @@ +Netpbm image data, size = 10 x 20, pixmap, ASCII text diff --git a/tests/pnm3.testfile b/tests/pnm3.testfile new file mode 100644 index 0000000..e28b9ab --- /dev/null +++ b/tests/pnm3.testfile @@ -0,0 +1,5 @@ +P3 +# CREATOR: GIMP PNM Filter Version 1.1 +10 20 +255 +255 diff --git a/tests/regex-eol.magic b/tests/regex-eol.magic new file mode 100644 index 0000000..883d74c --- /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 0000000..44d1eb7 --- /dev/null +++ b/tests/regex-eol.result @@ -0,0 +1 @@ +Ansible Vault text, version 1.1, using AES256 encryption diff --git a/tests/regex-eol.testfile b/tests/regex-eol.testfile new file mode 100644 index 0000000..607a852 --- /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 diff --git a/tests/test.c b/tests/test.c new file mode 100644 index 0000000..a942ba5 --- /dev/null +++ b/tests/test.c @@ -0,0 +1,158 @@ +/* + * Copyright (c) Christos Zoulas 2003. + * All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice immediately at the beginning of the file, without modification, + * this list of conditions, and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#include "magic.h" + +static const char *prog; + +static void * +xrealloc(void *p, size_t n) +{ + p = realloc(p, n); + if (p == NULL) { + (void)fprintf(stderr, "%s ERROR slurping file: %s\n", + prog, strerror(errno)); + exit(10); + } + return p; +} + +static char * +slurp(FILE *fp, size_t *final_len) +{ + size_t len = 256; + int c; + char *l = xrealloc(NULL, len), *s = l; + + for (c = getc(fp); c != EOF; c = getc(fp)) { + if (s == l + len) { + s = l + len; + len *= 2; + l = xrealloc(l, len); + } + *s++ = c; + } + if (s != l && s[-1] == '\n') + s--; + if (s == l + len) { + l = xrealloc(l, len + 1); + s = l + len; + } + *s++ = '\0'; + + *final_len = s - l; + return xrealloc(l, s - l); +} + +int +main(int argc, char **argv) +{ + struct magic_set *ms = NULL; + const char *result; + size_t result_len, desired_len; + char *desired = NULL; + int e = EXIT_FAILURE, flags, c; + FILE *fp; + + + prog = strrchr(argv[0], '/'); + if (prog) + prog++; + else + prog = argv[0]; + + if (argc == 1) + return 0; + + flags = 0; + while ((c = getopt(argc, argv, "ek")) != -1) + switch (c) { + case 'e': + flags |= MAGIC_ERROR; + break; + case 'k': + flags |= MAGIC_CONTINUE; + break; + default: + goto usage; + } + + argc -= optind; + argv += optind; + if (argc != 2) { +usage: + (void)fprintf(stderr, + "Usage: %s [-ek] TEST-FILE RESULT\n", prog); + goto bad; + } + + ms = magic_open(flags); + if (ms == NULL) { + (void)fprintf(stderr, "%s: ERROR opening MAGIC_NONE: %s\n", + prog, strerror(errno)); + return e; + } + if (magic_load(ms, NULL) == -1) { + (void)fprintf(stderr, "%s: ERROR loading with NULL file: %s\n", + prog, magic_error(ms)); + goto bad; + } + + if ((result = magic_file(ms, argv[0])) == NULL) { + (void)fprintf(stderr, "%s: ERROR loading file %s: %s\n", + prog, argv[1], magic_error(ms)); + goto bad; + } + fp = fopen(argv[1], "r"); + if (fp == NULL) { + (void)fprintf(stderr, "%s: ERROR opening `%s': %s", + prog, argv[1], strerror(errno)); + goto bad; + } + desired = slurp(fp, &desired_len); + fclose(fp); + (void)printf("%s: %s\n", argv[0], result); + if (strcmp(result, desired) != 0) { + result_len = strlen(result); + (void)fprintf(stderr, "%s: ERROR: result was (len %zu)\n%s\n" + "expected (len %zu)\n%s\n", prog, result_len, result, + desired_len, desired); + goto bad; + } + e = 0; +bad: + free(desired); + if (ms) + magic_close(ms); + return e; +} diff --git a/tests/uf2.result b/tests/uf2.result new file mode 100644 index 0000000..d93dca9 --- /dev/null +++ b/tests/uf2.result @@ -0,0 +1 @@ +UF2 firmware image, family ESP32-S2, address 00000000, 4829 total blocks diff --git a/tests/uf2.testfile b/tests/uf2.testfile Binary files differnew file mode 100644 index 0000000..be95440 --- /dev/null +++ b/tests/uf2.testfile diff --git a/tests/xclbin.result b/tests/xclbin.result new file mode 100644 index 0000000..11e31fe --- /dev/null +++ b/tests/xclbin.result @@ -0,0 +1 @@ +AMD/Xilinx accelerator AXLF (xclbin) file, 46226070 bytes, created Fri Mar 25 00:51:37 2022, shell "xilinx_u55c_gen3x16_xdma_3_202210_1", uuid e106e953-cf90-4024-e075-282d1a7d820b, 11 sections diff --git a/tests/xclbin.testfile b/tests/xclbin.testfile Binary files differnew file mode 100644 index 0000000..7a965c1 --- /dev/null +++ b/tests/xclbin.testfile diff --git a/tests/zstd-3-skippable-frames.result b/tests/zstd-3-skippable-frames.result new file mode 100644 index 0000000..4982c52 --- /dev/null +++ b/tests/zstd-3-skippable-frames.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.8+), Dictionary ID: 1 diff --git a/tests/zstd-dictionary-0.result b/tests/zstd-dictionary-0.result new file mode 100644 index 0000000..6fdb4a5 --- /dev/null +++ b/tests/zstd-dictionary-0.result @@ -0,0 +1 @@ +Zstandard dictionary (ID 0) diff --git a/tests/zstd-dictionary-1.result b/tests/zstd-dictionary-1.result new file mode 100644 index 0000000..623b563 --- /dev/null +++ b/tests/zstd-dictionary-1.result @@ -0,0 +1 @@ +Zstandard dictionary (ID 1) diff --git a/tests/zstd-dictionary-2.result b/tests/zstd-dictionary-2.result new file mode 100644 index 0000000..3d87c7a --- /dev/null +++ b/tests/zstd-dictionary-2.result @@ -0,0 +1 @@ +Zstandard dictionary (ID 285212672) diff --git a/tests/zstd-skippable-frame-0.result b/tests/zstd-skippable-frame-0.result new file mode 100644 index 0000000..432940a --- /dev/null +++ b/tests/zstd-skippable-frame-0.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.2) diff --git a/tests/zstd-skippable-frame-4.result b/tests/zstd-skippable-frame-4.result new file mode 100644 index 0000000..b6dc7be --- /dev/null +++ b/tests/zstd-skippable-frame-4.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.3) diff --git a/tests/zstd-skippable-frame-8.result b/tests/zstd-skippable-frame-8.result new file mode 100644 index 0000000..a0a0548 --- /dev/null +++ b/tests/zstd-skippable-frame-8.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.4) diff --git a/tests/zstd-skippable-frame-C.result b/tests/zstd-skippable-frame-C.result new file mode 100644 index 0000000..4982c52 --- /dev/null +++ b/tests/zstd-skippable-frame-C.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.8+), Dictionary ID: 1 diff --git a/tests/zstd-v0.2-FF.result b/tests/zstd-v0.2-FF.result new file mode 100644 index 0000000..432940a --- /dev/null +++ b/tests/zstd-v0.2-FF.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.2) diff --git a/tests/zstd-v0.2-FF.testfile b/tests/zstd-v0.2-FF.testfile new file mode 100644 index 0000000..6fe4f27 --- /dev/null +++ b/tests/zstd-v0.2-FF.testfile @@ -0,0 +1 @@ +"µ/ýÿ
\ No newline at end of file diff --git a/tests/zstd-v0.3-FF.result b/tests/zstd-v0.3-FF.result new file mode 100644 index 0000000..b6dc7be --- /dev/null +++ b/tests/zstd-v0.3-FF.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.3) diff --git a/tests/zstd-v0.3-FF.testfile b/tests/zstd-v0.3-FF.testfile new file mode 100644 index 0000000..dc50469 --- /dev/null +++ b/tests/zstd-v0.3-FF.testfile @@ -0,0 +1 @@ +#µ/ýÿ
\ No newline at end of file diff --git a/tests/zstd-v0.4-FF.result b/tests/zstd-v0.4-FF.result new file mode 100644 index 0000000..a0a0548 --- /dev/null +++ b/tests/zstd-v0.4-FF.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.4) diff --git a/tests/zstd-v0.4-FF.testfile b/tests/zstd-v0.4-FF.testfile new file mode 100644 index 0000000..f2768a2 --- /dev/null +++ b/tests/zstd-v0.4-FF.testfile @@ -0,0 +1 @@ +$µ/ýÿ
\ No newline at end of file diff --git a/tests/zstd-v0.5-FF.result b/tests/zstd-v0.5-FF.result new file mode 100644 index 0000000..0132e25 --- /dev/null +++ b/tests/zstd-v0.5-FF.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.5) diff --git a/tests/zstd-v0.5-FF.testfile b/tests/zstd-v0.5-FF.testfile new file mode 100644 index 0000000..a25f337 --- /dev/null +++ b/tests/zstd-v0.5-FF.testfile @@ -0,0 +1 @@ +%µ/ýÿ
\ No newline at end of file diff --git a/tests/zstd-v0.6-FF.result b/tests/zstd-v0.6-FF.result new file mode 100644 index 0000000..d4c10c3 --- /dev/null +++ b/tests/zstd-v0.6-FF.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.6) diff --git a/tests/zstd-v0.6-FF.testfile b/tests/zstd-v0.6-FF.testfile new file mode 100644 index 0000000..1c8ca59 --- /dev/null +++ b/tests/zstd-v0.6-FF.testfile @@ -0,0 +1 @@ +&µ/ýÿ
\ No newline at end of file diff --git a/tests/zstd-v0.7-00.result b/tests/zstd-v0.7-00.result new file mode 100644 index 0000000..c4b9c5b --- /dev/null +++ b/tests/zstd-v0.7-00.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.7), Dictionary ID: None diff --git a/tests/zstd-v0.7-21.result b/tests/zstd-v0.7-21.result new file mode 100644 index 0000000..254f027 --- /dev/null +++ b/tests/zstd-v0.7-21.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.7), Dictionary ID: 1 diff --git a/tests/zstd-v0.7-21.testfile b/tests/zstd-v0.7-21.testfile new file mode 100644 index 0000000..b40294e --- /dev/null +++ b/tests/zstd-v0.7-21.testfile @@ -0,0 +1 @@ +'µ/ý!
\ No newline at end of file diff --git a/tests/zstd-v0.7-22.result b/tests/zstd-v0.7-22.result new file mode 100644 index 0000000..47ce8d5 --- /dev/null +++ b/tests/zstd-v0.7-22.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.7), Dictionary ID: 513 diff --git a/tests/zstd-v0.7-22.testfile b/tests/zstd-v0.7-22.testfile new file mode 100644 index 0000000..8b72d68 --- /dev/null +++ b/tests/zstd-v0.7-22.testfile @@ -0,0 +1 @@ +'µ/ý"
\ No newline at end of file diff --git a/tests/zstd-v0.8-00.result b/tests/zstd-v0.8-00.result new file mode 100644 index 0000000..701bf4d --- /dev/null +++ b/tests/zstd-v0.8-00.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.8+), Dictionary ID: None diff --git a/tests/zstd-v0.8-01.result b/tests/zstd-v0.8-01.result new file mode 100644 index 0000000..dc92b68 --- /dev/null +++ b/tests/zstd-v0.8-01.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.8+), Dictionary ID: 2 diff --git a/tests/zstd-v0.8-01.testfile b/tests/zstd-v0.8-01.testfile new file mode 100644 index 0000000..88735e4 --- /dev/null +++ b/tests/zstd-v0.8-01.testfile @@ -0,0 +1 @@ +(µ/ý
\ No newline at end of file diff --git a/tests/zstd-v0.8-02.result b/tests/zstd-v0.8-02.result new file mode 100644 index 0000000..c43d921 --- /dev/null +++ b/tests/zstd-v0.8-02.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.8+), Dictionary ID: 770 diff --git a/tests/zstd-v0.8-02.testfile b/tests/zstd-v0.8-02.testfile new file mode 100644 index 0000000..db55433 --- /dev/null +++ b/tests/zstd-v0.8-02.testfile @@ -0,0 +1 @@ +(µ/ý
\ No newline at end of file diff --git a/tests/zstd-v0.8-03.result b/tests/zstd-v0.8-03.result new file mode 100644 index 0000000..0c4ae74 --- /dev/null +++ b/tests/zstd-v0.8-03.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.8+), Dictionary ID: 84148994 diff --git a/tests/zstd-v0.8-03.testfile b/tests/zstd-v0.8-03.testfile new file mode 100644 index 0000000..506b344 --- /dev/null +++ b/tests/zstd-v0.8-03.testfile @@ -0,0 +1 @@ +(µ/ý
\ No newline at end of file diff --git a/tests/zstd-v0.8-16.result b/tests/zstd-v0.8-16.result new file mode 100644 index 0000000..c43d921 --- /dev/null +++ b/tests/zstd-v0.8-16.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.8+), Dictionary ID: 770 diff --git a/tests/zstd-v0.8-16.testfile b/tests/zstd-v0.8-16.testfile new file mode 100644 index 0000000..3f87f79 --- /dev/null +++ b/tests/zstd-v0.8-16.testfile @@ -0,0 +1 @@ +(µ/ý
\ No newline at end of file diff --git a/tests/zstd-v0.8-20.result b/tests/zstd-v0.8-20.result new file mode 100644 index 0000000..701bf4d --- /dev/null +++ b/tests/zstd-v0.8-20.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.8+), Dictionary ID: None diff --git a/tests/zstd-v0.8-20.testfile b/tests/zstd-v0.8-20.testfile new file mode 100644 index 0000000..76fdbb8 --- /dev/null +++ b/tests/zstd-v0.8-20.testfile @@ -0,0 +1 @@ +(µ/ý
\ No newline at end of file diff --git a/tests/zstd-v0.8-21.result b/tests/zstd-v0.8-21.result new file mode 100644 index 0000000..4982c52 --- /dev/null +++ b/tests/zstd-v0.8-21.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.8+), Dictionary ID: 1 diff --git a/tests/zstd-v0.8-21.testfile b/tests/zstd-v0.8-21.testfile new file mode 100644 index 0000000..9ebeff4 --- /dev/null +++ b/tests/zstd-v0.8-21.testfile @@ -0,0 +1 @@ +(µ/ý!
\ No newline at end of file diff --git a/tests/zstd-v0.8-22.result b/tests/zstd-v0.8-22.result new file mode 100644 index 0000000..6d7c77e --- /dev/null +++ b/tests/zstd-v0.8-22.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.8+), Dictionary ID: 513 diff --git a/tests/zstd-v0.8-22.testfile b/tests/zstd-v0.8-22.testfile new file mode 100644 index 0000000..f2e55bf --- /dev/null +++ b/tests/zstd-v0.8-22.testfile @@ -0,0 +1 @@ +(µ/ý"
\ No newline at end of file diff --git a/tests/zstd-v0.8-23.result b/tests/zstd-v0.8-23.result new file mode 100644 index 0000000..1c4cc3a --- /dev/null +++ b/tests/zstd-v0.8-23.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.8+), Dictionary ID: 67305985 diff --git a/tests/zstd-v0.8-23.testfile b/tests/zstd-v0.8-23.testfile new file mode 100644 index 0000000..f66a18f --- /dev/null +++ b/tests/zstd-v0.8-23.testfile @@ -0,0 +1 @@ +(µ/ý#
\ No newline at end of file diff --git a/tests/zstd-v0.8-F4.result b/tests/zstd-v0.8-F4.result new file mode 100644 index 0000000..701bf4d --- /dev/null +++ b/tests/zstd-v0.8-F4.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.8+), Dictionary ID: None diff --git a/tests/zstd-v0.8-F4.testfile b/tests/zstd-v0.8-F4.testfile new file mode 100644 index 0000000..a4e4240 --- /dev/null +++ b/tests/zstd-v0.8-F4.testfile @@ -0,0 +1 @@ +(µ/ýô
\ No newline at end of file diff --git a/tests/zstd-v0.8-FF.result b/tests/zstd-v0.8-FF.result new file mode 100644 index 0000000..1c4cc3a --- /dev/null +++ b/tests/zstd-v0.8-FF.result @@ -0,0 +1 @@ +Zstandard compressed data (v0.8+), Dictionary ID: 67305985 diff --git a/tests/zstd-v0.8-FF.testfile b/tests/zstd-v0.8-FF.testfile new file mode 100644 index 0000000..bc63911 --- /dev/null +++ b/tests/zstd-v0.8-FF.testfile @@ -0,0 +1 @@ +(µ/ýÿ
\ No newline at end of file |