Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .github/tfg-in-work.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/window-formats.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/window-presets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/window-settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/window-several-batches.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .github/window.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
222 changes: 119 additions & 103 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ needs it finds out it exists.
- **Cost nothing and stay out of your way** - GPL-3.0, and the files you
generate are yours with no strings attached.

![The desktop window of Testing Files Generator building a set of files around an upload limit, and the files appearing in a folder as they are written](.github/tfg-in-work.gif)
![The desktop window of Testing Files Generator setting up a batch of log files and picking a format, then the size-boundaries and filename-handling presets writing their files into a folder beside it](.github/tfg-in-work.gif)

![The Star button at the top of this page, with a cursor pressing it](.github/star-the-repo.gif)

Expand All @@ -56,24 +56,104 @@ This README is also the manual. The short version is above the line, the full
reference is below it.

- [What it can do](#-what-it-can-do)
- [Install](#-install)
- [Quick start](#-quick-start)
- [Formats it generates](#-formats-it-generates)
- [Presets](#-presets)
- [The problem it solves](#-the-problem-it-solves)
- [What makes it different](#-what-makes-it-different)
- [Install](#-install)
- [Quick start](#-quick-start)
- [Reference](#reference)
- [Commands](#️-commands)
- [Recipes](#-recipes)
- [Formats in detail](#-formats-in-detail)
- [The manifest](#-the-manifest)
- [Presets](#-presets)
- [The desktop window](#️-the-desktop-window)
- [Using it in CI](#️-using-it-in-ci)
- [Questions](#-questions)
- [Where this is](#-where-this-is)
- [Everything inside a generated file is made up](#-everything-inside-a-generated-file-is-made-up)
- [Licence](#-licence)

## 📦 Install

**Download a binary.** Take the archive for your system from the
[releases page](https://github.com/donislawdev/TestingFilesGenerator/releases),
unpack it and run it. `tfg` is the command line, `tfg-gui` is the desktop
window. The Windows and macOS downloads are signed, so they start without a
warning about an unknown developer. The Linux ones are not, because desktop
Linux has no equivalent to sign them with.

**With Go installed:**

```
go install -tags noasm github.com/donislawdev/TestingFilesGenerator/cmd/tfg@latest
```

**From source.** Needs Go 1.27.0 or newer, and nothing else:

```
git clone https://github.com/donislawdev/TestingFilesGenerator
cd TestingFilesGenerator
go build -tags "$(cat .github/build-tags)" ./cmd/tfg
```

**The tag is not optional.** The AVIF encoder has an assembly path that reads
past the end of a buffer and takes the process down on some picture sizes, and
the tag turns it off. Building without it does not compile, and says so. The
files it produces are the same either way.

The desktop window is a second binary,
`go build -tags "$(cat .github/build-tags)" ./cmd/tfg-gui`. It draws
through OpenGL and reaches it through C, so that one needs a C compiler and is
built natively on each system. Built without one it still compiles, and says on
start that it has no window in it and that everything is on the command line.

The window needs OpenGL 2.1 to draw. On Windows the archive carries a
software renderer for machines whose graphics driver offers none - Mesa
llvmpipe, in an `opengl` folder next to `tfg-gui.exe` - and the window uses it
by itself when the driver refuses: a virtual machine without 3D acceleration,
a remote desktop, a server. Drawn that way it is slower and says so on its
About screen. On a machine with a driver the folder is not touched unless
you ask: `tfg-gui --software-gl` loads the renderer on any Windows machine,
which is the way to see the window as a machine without a driver sees it. Keep
the folder next to the program: without it, and without a driver, the window
says what it looked for in a dialog and on standard error, and exits 1. Linux
has Mesa in the system and macOS has never lacked what the toolkit needs, so
nothing of the kind ships there, and there the flag says so and changes
nothing. The command line needs no graphics driver and does everything the
window does.

## 🚀 Quick start

**1. Make a file.** One PNG, exactly two megabytes:

```
tfg generate --format png --size 2mb --out ./out
```

**2. Make a lot of files.** Ten thousand log files, each between one and eight
kilobytes, with the sizes drawn from the seed so tomorrow gives the same set.
**Give each run its own directory** - the manifest is the only record of what a
run wrote, so the tool refuses to write a second one over it:

```
tfg generate --format log --size-range 1kb-8kb --count 10000 --out ./logs
```

**3. Check them, then remove them.**

```
tfg verify ./logs/manifest.json
tfg cleanup ./logs/manifest.json --yes
```

```
logs matches ./logs/manifest.json: 10000 files checked
```

**Sizes count in 1024s**, the way your file manager does, so `2mb` means
2097152 bytes. A plain byte count works too: `--size 2097152`.

## 📁 Formats it generates

Twenty six, and every one is a **real file of that format** - it opens in the
Expand All @@ -94,6 +174,32 @@ Most of them take settings of their own - image dimensions, JPEG quality, PDF
page count, rows and columns in a spreadsheet, what goes inside an archive. See
[format settings](#per-format-settings).

## 🧪 Presets

A preset is a ready-made set of files that answers one common testing question,
so you do not have to design the set yourself. Every file in it says what it is
for, and the manifest says how your system should react to it:

| preset | the question it answers |
|---|---|
| `empty-and-minimal` | Does a file that is valid and as small as the format allows get through? |
| `filename-handling` | Will my system store, show and give back a file name it did not expect? |
| `size-boundaries` | Is a size limit enforced exactly where it is declared? |
| `tabular-import` | Does my table import survive what real tools export? |
| `text-encoding` | Does my reader know which encoding a file is in, or is it guessing? |
| `upload-validation` | Does my upload form take what it should and turn the rest away? |

```
tfg preset show size-boundaries
tfg generate --preset size-boundaries --limit 10mb --out ./limits
```

`show` tells you what the set would cost before you build it, and says outright
when a number is a placeholder of ours rather than a limit of yours. Presets are
ordinary recipes underneath - `tfg preset eject size-boundaries` prints the
recipe and you edit it from there. The Presets screen of the window offers the
same ones.

## 🤔 The problem it solves

You are testing software that accepts files from people. Sooner or later you
Expand Down Expand Up @@ -162,86 +268,6 @@ And where the right answer genuinely depends on your own policy, the manifest
says `unspecified` instead of inventing one. A generator that guesses produces
false failures, and a suite that cries wolf gets switched off.

## 📦 Install

**Download a binary.** Take the archive for your system from the
[releases page](https://github.com/donislawdev/TestingFilesGenerator/releases),
unpack it and run it. `tfg` is the command line, `tfg-gui` is the desktop
window. The Windows and macOS downloads are signed, so they start without a
warning about an unknown developer. The Linux ones are not, because desktop
Linux has no equivalent to sign them with.

**With Go installed:**

```
go install -tags noasm github.com/donislawdev/TestingFilesGenerator/cmd/tfg@latest
```

**From source.** Needs Go 1.27.0 or newer, and nothing else:

```
git clone https://github.com/donislawdev/TestingFilesGenerator
cd TestingFilesGenerator
go build -tags "$(cat .github/build-tags)" ./cmd/tfg
```

**The tag is not optional.** The AVIF encoder has an assembly path that reads
past the end of a buffer and takes the process down on some picture sizes, and
the tag turns it off. Building without it does not compile, and says so. The
files it produces are the same either way.

The desktop window is a second binary,
`go build -tags "$(cat .github/build-tags)" ./cmd/tfg-gui`. It draws
through OpenGL and reaches it through C, so that one needs a C compiler and is
built natively on each system. Built without one it still compiles, and says on
start that it has no window in it and that everything is on the command line.

The window needs OpenGL 2.1 to draw. On Windows the archive carries a
software renderer for machines whose graphics driver offers none - Mesa
llvmpipe, in an `opengl` folder next to `tfg-gui.exe` - and the window uses it
by itself when the driver refuses: a virtual machine without 3D acceleration,
a remote desktop, a server. Drawn that way it is slower and says so on its
About screen. On a machine with a driver the folder is not touched unless
you ask: `tfg-gui --software-gl` loads the renderer on any Windows machine,
which is the way to see the window as a machine without a driver sees it. Keep
the folder next to the program: without it, and without a driver, the window
says what it looked for in a dialog and on standard error, and exits 1. Linux
has Mesa in the system and macOS has never lacked what the toolkit needs, so
nothing of the kind ships there, and there the flag says so and changes
nothing. The command line needs no graphics driver and does everything the
window does.

## 🚀 Quick start

**1. Make a file.** One PNG, exactly two megabytes:

```
tfg generate --format png --size 2mb --out ./out
```

**2. Make a lot of files.** Ten thousand log files, each between one and eight
kilobytes, with the sizes drawn from the seed so tomorrow gives the same set.
**Give each run its own directory** - the manifest is the only record of what a
run wrote, so the tool refuses to write a second one over it:

```
tfg generate --format log --size-range 1kb-8kb --count 10000 --out ./logs
```

**3. Check them, then remove them.**

```
tfg verify ./logs/manifest.json
tfg cleanup ./logs/manifest.json --yes
```

```
logs matches ./logs/manifest.json: 10000 files checked
```

**Sizes count in 1024s**, the way your file manager does, so `2mb` means
2097152 bytes. A plain byte count works too: `--size 2097152`.

---

# Reference
Expand Down Expand Up @@ -633,25 +659,6 @@ produced the file, and `summary.by_target` counts the files each target came to.
A recipe with several targets can therefore be checked target by target without
reading file names.

## 🧪 Presets

A preset is a ready made set of files that answers a common testing question, so
you do not have to design the set yourself:

```
tfg preset list
tfg preset show size-boundaries
tfg generate --preset size-boundaries --limit 10mb --out ./limits
```

`show` tells you what the set would cost before you build it, and says outright
when a number is a placeholder of ours rather than a limit of yours. Presets are
ordinary recipes underneath - `tfg preset eject size-boundaries` prints the
recipe and you edit it from there.

`tfg preset list` names every preset your build ships, and the Presets
screen of the window offers the same ones.

## 🖥️ The desktop window

The same engine with a window on it, for the testing that is not scripted. It is
Expand All @@ -663,6 +670,15 @@ Four screens - one batch, presets, several batches at once, and about. It shows
what a run would cost before writing anything, reports progress while it runs,
and can be cancelled part way without leaving a half written file behind.

<p>
<img src=".github/window-presets.png" width="49%" alt="The Presets screen of the window, with the list of presets open">
<img src=".github/window-settings.png" width="49%" alt="One batch of log files in the window, with the settings the log format takes">
</p>
<p>
<img src=".github/window-several-batches.png" width="49%" alt="The Several batches screen of the window, where each batch has its own format and size">
<img src=".github/window-formats.png" width="49%" alt="The list of formats in the window, grouped by kind and filtered as you type">
</p>

It does not open a recipe file yet. Recipes are a command line thing for now,
and the window builds its batches in the form.

Expand Down
Loading
Loading