This file is indexed.

/usr/include/ept/test-runner.h is in libept-dev 1.0.6~exp1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
#include <unistd.h>

#define RUN(x, y) x().y()

struct RunTest {
    const char *name;
    void (*run)();
};

struct RunSuite {
    const char *name;
    RunTest *tests;
    int testCount;
};

struct RunAll {
    RunSuite *suites;
    int suiteCount;
    FILE *status, *confirm;

    RunSuite *findSuite( std::string name ) {
        for ( int i = 0; i < suiteCount; ++i )
            if ( suites[i].name == name )
                return suites + i;
        return 0;
    }

    void waitForAck() {
        size_t n = 0; char *line = 0;
        size_t read = getline( &line, &n, confirm );
        assert_eq( read, 4 );
        assert_eq( std::string( "ack\n" ), line );
        free( line );
    }

    void runSuite( RunSuite &s, int fromTest, int suite, int suiteCount )
    {
        fprintf( status, "s/s: (%d/%d) %s\n", suite + 1, suiteCount, s.name );
        for ( int i = fromTest; i < s.testCount; ++i ) {
            fprintf( status, "t/s: (%d/%d) %s\n", i, s.testCount,
                     s.tests[i].name );
            fflush( status );
            waitForAck();
            s.tests[i].run();
            fprintf( status, "t/d: %s\n", s.tests[i].name );
            fflush( status );
            waitForAck();
            // exit( 0 ); // TODO make this optional; safety vs
                       // performance tradeoff
        }
        fprintf( status, "s/d: %s\n", s.name );
    }

    void runFrom( int suite, int test )
    {
        for ( int i = suite; i < suiteCount; ++i ) {
            assert( suite <= suiteCount );
            runSuite( suites[i], test, i, suiteCount );
            test = 0;
        }
    }
};