-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile-testfiles
443 lines (357 loc) · 15.1 KB
/
Makefile-testfiles
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
# Instructions for generating sample test files
#
# Copyright (c) 2023 Dan Fandrich <dan@coneharvesters.com>
# Licensed under the MIT license (see LICENSE).
#
# The resulting files are checked in (with a few exceptions at the end) so that
# these commands never need to be run again. Smaller file size is sometimes
# prioritized over ease of creation. All generated files must also be able to
# be released to the public domain. Some of these commands were documented
# after the fact & are therefore not well tested.
#
# Many of these rules must be run as root to generate reproducible output.
all:
@echo Use this makefile to generate individual test files
foo:
echo foo >foo
# Note: some formats need this ownership changed to avoid leaking user info
# and for better consistency
chown root:root foo
type1.png: type1.pbm
@echo This file was manually converted and tags added from type1.pbm with Kolourpaint
type1.tiff: type1.pbm
@echo This file was manually converted with Gimp and tags added using tiffset
type2.png: type1.pbm
@echo This file was manually converted and tags added from type1.pbm with Kolourpaint
type1.pdf:
@echo This file was manually created in Scribus with "Outline all fonts" enabled
type1.wacz:
@echo This file was manually created using ArchiveWeb.page with a web
@echo server run with 'python3 -m http.server'
type1.warc.gz:
@echo This file was manually created using ArchiveWeb.page with a simple
@echo custom Python web server that adds custom headers that was run with:
@echo " python2 httpd.py 8000 'WARC-Date: April 1, 2345' 'isPartOf: bogus header to be ignored"
@echo and the final .warc.gz file was extracted from the .wacz file produced.
type1.epub:
@echo This file was manually created in Libreoffice
type1.wml:
@echo This file was manually created in AbiWord
type1.cab:
@echo This file was created in Windows XP with the commands:
@echo ' echo foo >foo'
@echo ' makecab foo type1.cab'
type1.gcode:
@echo This file was created in PrusaSlicer 2.5.0 by slicing a 1×1×0.2mm
@echo box without skirt then manually deleting the embedded thumbnails and
@echo prusa_config metadata
type1.arj: foo
echo ARJ archive comment >cmt
arj a type1.arj foo
arj c type1.arj -zcmt
type1.rpm: autodescribe-test.spec
rpmbuild -bb -D'vendor nobody' -D'packager dfandrich' -D'_buildhost localhost' autodescribe-test.spec
type1.wav:
dd if=/dev/zero count=64 bs=1 | sox -r 8000 -c 1 -t s1 - empty.wav
ffmpeg -i empty.wav -acodec copy -metadata title='WAV title' -y "$@"
type1.aiff:
dd if=/dev/zero count=64 bs=1 | sox -r 8000 -c 1 -t s1 - empty.wav
ffmpeg -i empty.wav -acodec copy -metadata title='AIFF title' -y "$@"
type1.mp3: type1.wav
lame --noreplaygain type1.wav "$@"
id3v2 -1 -a 'MP3 Artist' -t 'MP3 Song' -c 'MP3 Comment' "$@"
type2.mp3: type1.wav
lame --noreplaygain type1.wav "$@"
id3v2 -2 -a 'MP3 Artist' -t 'MP3 Song' -c 'MP3 Comment' "$@"
type1.flac: type1.wav
flac -o "$@" --padding=0 type1.wav
printf "TITLE=FLAC title\nARTIST=FLAC artist\n" | metaflac --remove-all-tags --import-tags-from=- -- "$@"
type1.ogg:
dd if=/dev/zero count=64 bs=1 > empty.raw
oggenc -r -B 8 -C 1 -R 8000 -q -1 -a 'OGG artist' -t 'OGG title' -d 2021 -G Experimental -o "$@" empty.raw
type2.ogg:
dd if=/dev/zero count=64 bs=1 > empty.raw
oggenc -r -B 8 -C 1 -R 8000 -q -1 -t 'OGG title' -o "$@" empty.raw
type1.webm:
ppmmake black 160 120 | pnmtopng >black.png
ffmpeg -r 15 -f image2 -i black.png -metadata title='WEBM title' -metadata creation_time='2023-04-05T06:07:08.0910Z' -y "$@"
type1.mp4:
ppmmake black 160 120 | pnmtopng >black.png
ffmpeg -r 12 -f image2 -i black.png -metadata title='MPEG-4 title' -metadata creation_time='2023-04-05T06:07:08.09Z' -pix_fmt yuv420p -vcodec libx264 -bf 0 -tune stillimage -y "$@"
type1.avi:
ppmmake black 160 120 | pnmtopng >black.png
ffmpeg -r 12 -f image2 -i black.png -metadata title='AVI title' -pix_fmt yuvj422p -vcodec mjpeg -y tmp.avi
# Mencoder produces a smaller file, so reencode it only for that reason
mencoder tmp.avi -of avi -ovc copy -info name='AVI title' -o "$@"
type1.zpaq: foo
-rm "$@"
zpaq a "$@" foo
type1.ppm:
ppmmake black 1 1 > "$@"
type1.jpg:
ppmmake black 1 1 | pnmtojpeg --comment='JPEG comment' > "$@"
type2.jpg:
ppmmake black 1 1 | pnmtojpeg > black.jpg
exif --tag=0x10e --ifd=0 -c -o "$@" --set-value='EXIF description' black.jpg
type1.tar: foo
tar -cvf "$@" --owner=root --group=root -b 1 foo
type1.cpio: foo
cpio -o --owner=root:root -H newc <<< foo > "$@"
type1.tgz: foo foo.1
mkdir directory
cp foo directory
cp foo.1 directory
tar --owner=root --group=root -czvf "$@" directory/
type1.lzh: foo
echo LZH comment in desc.sdi file > desc.sdi
lha a type1.lzh foo desc.sdi
type1.zip: foo
printf 'Comment for file foo\nZip comment\nspanning two lines\n.\n' | zip -0 -c -z "$@" foo
type2.zip: foo
printf 'ZIP comment in\ndesc.sdi file\n' > desc.sdi
zip -0 "$@" foo desc.sdi
type1.shar: foo
shar foo > "$@"
type1.gz: foo
gzip foo
mv foo.gz "$@"
type1.bz2: foo
bzip2 foo
mv foo.bz2 "$@"
type1.xz: foo
xz foo
mv foo.xz "$@"
type1.Z: foo
compress foo
mv foo.Z "$@"
type1.lzma: foo
lzma foo
mv foo.lzma "$@"
type1.lzo: foo
lzop foo
mv foo.lzo "$@"
type1.lz: foo
lzip foo
mv foo.lz "$@"
type1.rz: foo
rzip -0 -o "$@" foo
type1.7z: foo
7za a "$@" foo
# Deterministic mode, where owners, etc. are zeroed
type1.a: foo
ar rD "$@" foo
# Preserve metadata, although use fixed uid/gid
type2.a: foo
chmod 644 foo
chown 1000:1000 foo
ar r "$@" foo
type1.amf:
openscad --export-format amf -o - <(echo 'linear_extrude(1) polygon([[0,0], [0,1], [1,0], [0,0]]);') | xmlstarlet edit -a /amf/metadata -t elem -n 'metadata' -v "AMF name" -a '/amf/metadata[not(@type)]' -t attr -n type -v name > "$@"
type2.amf: type1.amf
cp type1.amf type2.amf
zip -qm type2-zip.amf type2.amf
mv type2-zip.amf type2.amf
type1.stl:
openscad --export-format stl -o - <(echo 'linear_extrude(1) polygon([[0,0], [0,1], [1,0], [0,0]]);') | sed -e 's/OpenSCAD_Model$$/STL_name/' > "$@"
type2.stl:
openscad --export-format binstl -o "$@" <(echo 'linear_extrude(1) polygon([[0,0], [0,1], [1,0], [0,0]]);')
printf 'STL name\n\x00\x00\x00\x00\x00\x00' | dd of="$@" conv=notrunc
type1.3mf:
test ! -e 3D # Abort if found to avoid accidentally deleting more than we want
openscad --export-format 3mf -o "$@" <(echo 'linear_extrude(1) polygon([[0,0], [0,1], [1,0], [0,0]]);')
unzip -q "$@" 3D/3dmodel.model
xmlstarlet edit -L -i "/*[local-name()='model']/*[local-name()='resources']" -t elem -n metadata -v '3MF title' -a "//*[local-name()='metadata'][not(@name)]" -t attr -n name -v Title 3D/3dmodel.model
zip -f "$@" 3D/3dmodel.model
rm -r 3D
type1.dat: foo
pack foo "$@"
type2.dat: foo
dat -a -f "$@" foo
type1.squashfs: foo
mksquashfs foo "$@" -nopad -all-root -no-exports
# With volume ID
# isoinfo 3.02 complains about corruption if cdrkit 1.1.11 is used for this
type1.iso: foo
mkdir directory.tmp
cp foo directory.tmp
mkisofs -o "$@" -v -no-pad -appid application_id -publisher publisher_id -preparer preparer_id -V volume_id -volset volset_id directory.tmp
rm -r directory.tmp
# No volume ID
# isoinfo 3.02 complains about corruption if cdrkit 1.1.11 is used for this
type2.iso: foo
mkdir directory.tmp
cp foo directory.tmp
mkisofs -o "$@" -v -no-pad -appid application_id -publisher publisher_id -preparer preparer_id -V '' -volset volset_id directory.tmp
rm -r directory.tmp
type1.pcapng:
randpkt -b 32 -c 2 -t arp "$@".tmp
editcap -a '1:Packet comment' --capture-comment 'PCAP capture comment' -t 1639872000 "$@".tmp "$@"
-rm "$@".tmp
type1.db:
printf 'key\nvalue\n' | db53_load -T -t hash -c db_pagesize=512 "$@"
type1.gdbm:
gdbmtool --norc -b 512 --newdb "$@" store key value
type1.sqlite:
sqlite3 "$@" 'PRAGMA page_size=512; CREATE TABLE tab(k, v); INSERT INTO tab (k, v) VALUES ("key", "value");'
type1.jffs2: foo
mkdir directory.tmp
cp foo directory.tmp
setfattr -n user.xdg.comment -v 'Extended filesystem attribute comment' directory.tmp/foo
mkfs.jffs2 -v -l -q --with-xattr -o "$@" -r directory.tmp
rm -r directory.tmp
type1.class:
echo 'public class type1 { }' >type1.java
javac type1.java
rm type1.java
type1.jar:
echo 'class Foo { public static void main(String []args) { System.out.println("foo"); } };' > Foo.java
javac Foo.java
echo 'Application-Name: Jar Application Name' >manifest
jar cfem "$@" Foo manifest Foo.class
type1.gmo: type1.po
msgfmt -c --statistics --verbose -o "$@" "$^"
type1.egg:
test ! -e setup.cfg # Abort if found to avoid accidentally overwriting something important
printf '[metadata]\nname = python-package-name\nsummary = package summary\nversion = 0\nauthor = Dan Fandrich\nlicense = public domain\nclassifiers = Programming Language :: Python\n' >setup.cfg
python -c 'from setuptools import setup;setup()' bdist_egg
mv dist/python_package_name-0-py*.egg "$@"
type1.whl:
test ! -e setup.cfg # Abort if found to avoid accidentally overwriting something important
printf '[build-system]\nrequires = ["setuptools>=42", "wheel"]\nbuild-backend = "setuptools.build_meta"\n' >pyproject.toml
printf '[metadata]\nname = python-package-name\nsummary = package summary\nversion = 0\nauthor = Dan Fandrich\nlicense = public domain\nclassifiers = Programming Language :: Python\n' >setup.cfg
python -m pip wheel .
mv python_package_name-0-py3-none-any.whl "$@"
type1.slob:
# Requires https://github.com/itkach/slob/
printf 'import slob\nwith slob.create("type1.slob") as f:\n f.add(b"Word", "word")\n f.tag("label", "SLOB file label")\n' | python3
type1.diff: foo
echo older > older.tmp
touch -d '-400 days' -r older.tmp older.tmp
echo newest > newest.tmp
diff -u /dev/null older.tmp > "$@" || test "$$?" -eq 1
diff -u /dev/null newest.tmp >> "$@" || test "$$?" -eq 1
diff -u /dev/null foo >> "$@" || test "$$?" -eq 1
# resource file for building a Win32 executable
define TYPE1RC
#include <winresrc.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,1,0
PRODUCTVERSION 0,1,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0L
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "unincorporated\0"
VALUE "FileDescription", "Windows executable name\0"
VALUE "FileVersion", "0.1\0"
VALUE "InternalName", "type1\0"
VALUE "OriginalFilename", "type1.exe\0"
VALUE "ProductName", "Test executable\0"
VALUE "ProductVersion", "0.1\0"
VALUE "LegalCopyright", "public domain\0"
VALUE "License", "public domain\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 0x4b0
END
END
/* Manifest */
//CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST
//BEGIN
// "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>"
// "<assembly xmlns=""urn:schemas-microsoft-com:asm.v1"" manifestVersion=""1.0"">"
// "<assemblyIdentity name=""Windows executable name"" version="""
// "0."
// "1."
// "0.0"" type=""win32""/>"
// "<compatibility xmlns=""urn:schemas-microsoft-com:compatibility.v1"">"
// "<application>"
// "<supportedOS Id=""{e2011457-1546-43c5-a5fe-008deee3d3f0}""/>" /* Vista / Server 2008 */
// "<supportedOS Id=""{35138b9a-5d96-4fbd-8e2d-a2440225f93a}""/>" /* 7 / Server 2008 R2 */
// "<supportedOS Id=""{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}""/>" /* 8 / Server 2012 */
// "<supportedOS Id=""{1f676c76-80e1-4239-95bb-83d0f6d0da78}""/>" /* 8.1 / Server 2012 R2 */
// "<supportedOS Id=""{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}""/>" /* 10 / Server 2016 */
// "</application>"
// "</compatibility>"
// "<trustInfo xmlns=""urn:schemas-microsoft-com:asm.v3"">"
// "<security>"
// "<requestedPrivileges>"
// "<requestedExecutionLevel level=""asInvoker"" uiAccess=""false""/>"
// "</requestedPrivileges>"
// "</security>"
// "</trustInfo>"
// "</assembly>"
//END
endef
export TYPE1RC
type1.exe:
# See https://stackoverflow.com/questions/42022132/how-to-create-tiny-pe-win32-executables-using-mingw
echo "$$TYPE1RC" > type1.rc
x86_64-w64-mingw32-windres -F pe-i386 -i type1.rc -o type1.o
echo '#include <windows.h>' > test.c
echo 'void __cdecl mainCRTStartup() { DWORD num; HANDLE hf = GetStdHandle(STD_OUTPUT_HANDLE); WriteFile(hf, "foo\r\n", 5, &num, 0); ExitProcess(0); }' >>test.c
x86_64-w64-mingw32-gcc -m32 -s -Os -fno-ident -fno-stack-protector -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -mconsole -o type1.exe test.c type1.o -nostdlib -nodefaultlibs -lkernel32
type1.deb:
mkdir type1-0.0.1
echo foo >type1-0.0.1/foo
echo public domain >license
touch type1-0.0.1/Makefile
tar czvf type1-0.0.1.tar.gz type1-0.0.1
rm type1-0.0.1/*
cd type1-0.0.1 && DEBEMAIL="your@example.com" DEBFULLNAME="Fake Maintainer" dh_make -y -i -c custom --copyrightfile ../../license -f ../type1-0.0.1.tar.gz && sed -i -e '/^Description:/{i\Description: Deb package description' -e 'i\ Long deb package description' -e '}' -e '/^Description:/,$$d' debian/control && dpkg-buildpackage -d
type1.cfi: foo
dd if=/dev/zero of=160.img bs=512 count=320
mkdosfs -n 160_FD 160.img
sudo losetup /dev/loop0 160.img
mv foo FOO
# mtools is assumed to be configured so drive L: maps to /dev/loop0
sudo mcopy FOO l:
sudo losetup -d /dev/loop0
dskconv -itype raw -otype cfi -format ibm160 160.img type1.cfi
type1.vhd:
VBoxManage createmedium disk --filename=type1.vhd --format=VHD --sizebyte=163840
VBoxManage closemedium type1.vhd
type1.man: type1.1
# type1.1 is lightly-edited version of testfiles/type1.1
nroff -man -c "$^" >"$@"
# It's best to use a version of dar <= 2.7.0 to create this file to avoid test
# failures due to an archive created by a too-new version of dar.
type1.1.dar: foo
# sleep to give files & dirs slightly different times
sleep 2
mkdir -p directory.tmp/dir
mv foo directory.tmp
sleep 2
echo bar > directory.tmp/dir/bar
touch -d '2020-12-23 04:05:06' directory.tmp/dir/bar
cd directory.tmp && dar -w --user-comment="DAR comment" -c ../type1
type1.zoo: foo
printf "Zoo archive comment\nSecond line of comment\n/END\n" | zoo aC type1.zoo foo
# input.wav is a short file of blank created in Audacity with the other
# metadata already included. It can't seem to create the creation time so it's
# added here.
type1.m4a: input.wav
ffmpeg -i "$^" -metadata creation_time='2024-02-05 10:11:12' "$@"
# The following files are pretty huge compared to others so they aren't
# included in the repository but can be generated here if needed.
type1.AppImage:
mkdir directory.tmp
printf '#!/bin/sh\necho AppImage\n' > directory.tmp/AppRun
chmod 755 directory.tmp/AppRun
ppmmake black 16 16 | pnmtopng > directory.tmp/icon.png
printf '[Desktop Entry]\nType=Application\nVersion=1.0\nName=AppImage test\nExec=AppRun\nTerminal=true\nCategories=Development;\nIcon=icon\n' > directory.tmp/AppImage.desktop
ARCH=x86_64 appimagetool directory.tmp type1.AppImage
# TDB files can be as small as 12 KiB holding data, so we need to figure out
# how to create one that small. --non-persistent is smaller but it results in
# "ERROR: could not open dbname" on read.
type1.tdb:
dbwrap_tool --persistent --configfile=/dev/null "$@" store key uint32 1234