view tests/runminitest.d @ 342:d8b165faae9b trunk

[svn r363] Fixed a problem with the mini-test-driver.
author lindquist
date Sun, 13 Jul 2008 02:55:41 +0200
parents 1bb99290e03a
children c028fd91b3b0
line wrap: on
line source

module runminitest;

import std.file;
import std.path;
import std.process;
import std.stdio;
import std.string;

int main(string[] args) {
    string[] bad;
    string[] badrun;

    chdir("mini");

    auto contents = listdir(".", "*.d");
    foreach(c; contents) {
        string cmd = format("llvmdc %s -quiet -of%s", c, getName(c));
        foreach(v; args[1..$]) {
            cmd ~= ' ';
            cmd ~= v;
        }
        writefln(cmd);
        if (system(cmd) != 0) {
            bad ~= c;
        }
        else if (system(getName(c)) != 0) {
            badrun ~= c;
        }
    }

    int ret = 0;
    if (bad.length > 0 || badrun.length > 0) {
        writefln(bad.length, '/', contents.length, " of the tests failed to compile:");
        foreach(b; bad) {
            writefln("  ",b);
        }
        writefln(badrun.length, '/', contents.length - bad.length, " of the compiled tests failed to run:");
        foreach(b; badrun) {
            writefln("  ",b);
        }
        ret = 1;
    }

    writefln(contents.length - bad.length - badrun.length, '/', contents.length, " of the tests passed");
    return ret;
}