Skip to content

Tests with certain filenames can cause tests to not be detected or fail #24

@kylemclean

Description

@kylemclean

Problem 1: causes tests to not be detected

I have only one test, a.
The input file a.in is the source code of a program that does nothing. The output file a.out is empty.
As expected, the test passes.
The folder structure looks like this:

tests
├── GazpreaConfig.json
├── input
│   └── untitled
│       └── a.in
└── output
    └── untitled
        └── a.out

If I add an extraneous file to the input directory named a-.in without a corresponding file in the output directory named a-.out:

tests
├── GazpreaConfig.json
├── input
│   └── untitled
│       ├── a.in
│       └── a-.in
└── output
    └── untitled
        └── a.out

the tester no longer picks up a as a test:

Tests:
Testing executable: untitled -> "../bin/gazc"
With toolchain: gazprea -> [gazc, lli]
Toolchain passed 0 / 0
Summary:
untitled:

The same happens if I add a file to the output directory named a-.out without a corresponding file in the input directory named a-.in:

tests
├── GazpreaConfig.json
├── input
│   └── untitled
│       └── a.in
└── output
    └── untitled
        ├── a.out
        └── a-.out

However, if both a-.in and a-.out exist in their respective directories like so:

tests
├── GazpreaConfig.json
├── input
│   └── untitled
│       ├── a.in
│       └── a-.in
└── output
    └── untitled
        ├── a.out
        └── a-.out

then both a and a- will be picked up by the tester.
This problem only arises when the extraneous file has the same name as the original test but with a hyphen appended. If it has any other name, the original test will be picked up by the tester as normal.

Problem 2: causes tests using input streams to fail

I have two tests, a and b.
a.in is the source code of a program that reads a character from the input stream and exits.
b.in is the source code of a program that does nothing and exits.
Both a.out and b.out are empty.
The input stream file a.ins contains an arbitrary character.
Both tests pass, as expected.
However, if I rename the test b to a- by renaming b.in to a-.in and b.out to a-.out like so:

tests
├── GazpreaConfig.json
├── input
│   └── untitled
│       └── streams
│           ├── a.in
│           └── a-.in
├── inStream
│   └── untitled
│       └── streams
│           └── a.ins
└── output
    └── untitled
        └── streams
            ├── a.out
            └── a-.out

test a will now fail:

Tests:
  untitled: 1
Testing executable: untitled -> "../bin/gazc"
With toolchain: gazprea -> [gazc, lli]
Entering package: untitled
  Entering subpackage: untitled
    a-: PASS
Command error: Subcommand timed out:
  /home/kyle/llvm-ins/bin/lli /home/kyle/gazprea-untitled/tests/gazc.ll > "/home/kyle/gazprea-untitled/tests/lli-temp.out"
    a: FAIL
  Subpackage passed 1 / 2
 Package passed 1 / 2
Toolchain passed 1 / 2
Summary:
untitled:
  Self tests:
    untitled: 1 / 2 -> FAIL

This could be caused by the corresponding input stream file a.ins not being used when running test a, though I have not verified this.
a continues to fail after renaming test a- to a-anything.
a will start passing again when a- is renamed to something that doesn't start with "a-".
a will also start passing again if it is renamed to b.

Download the test files: tests.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions