mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 08:52:18 +01:00
Tweak the test output.
This commit is contained in:
1 parent
9724466233
commit
71a3ad6563
3 files changed
+18
-9
No files matched your search
@@ -66,7 +66,6 @@ func listDir(dirname string) (filenames []string, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func do(dirname string, filename string) (failed bool, err error) {
|
func do(dirname string, filename string) (failed bool, err error) {
|
||||||
fmt.Printf(" %s:\n", filename)
|
|
||||||
workDir, err := ioutil.TempDir("", "puffs-test-c")
|
workDir, err := ioutil.TempDir("", "puffs-test-c")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@@ -76,7 +75,6 @@ func do(dirname string, filename string) (failed bool, err error) {
|
|||||||
for _, cc := range []string{"clang", "gcc"} {
|
for _, cc := range []string{"clang", "gcc"} {
|
||||||
in := filepath.Join(dirname, filename)
|
in := filepath.Join(dirname, filename)
|
||||||
out := filepath.Join(workDir, cc+".out")
|
out := filepath.Join(workDir, cc+".out")
|
||||||
fmt.Printf(" %-8s", cc+":")
|
|
||||||
|
|
||||||
ccCmd := exec.Command(cc, "-std=c99", "-Wall", "-Werror", "-o", out, in)
|
ccCmd := exec.Command(cc, "-std=c99", "-Wall", "-Werror", "-o", out, in)
|
||||||
ccCmd.Stdout = os.Stdout
|
ccCmd.Stdout = os.Stdout
|
||||||
|
|||||||
+3
-5
@@ -5,21 +5,19 @@
|
|||||||
To manually run this test:
|
To manually run this test:
|
||||||
|
|
||||||
for cc in clang gcc; do
|
for cc in clang gcc; do
|
||||||
printf "%-8s" "$cc:"
|
|
||||||
$cc -std=c99 -Wall -Werror basic.c && ./a.out
|
$cc -std=c99 -Wall -Werror basic.c && ./a.out
|
||||||
rm -f a.out
|
rm -f a.out
|
||||||
done
|
done
|
||||||
|
|
||||||
It should print:
|
Each edition should print "PASS", amongst other information, and exit(0).
|
||||||
clang: PASS (N tests run)
|
|
||||||
gcc: PASS (N tests run)
|
|
||||||
for some value of N.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../testlib/testlib.c"
|
#include "../testlib/testlib.c"
|
||||||
|
|
||||||
#include "../../../gen/c/gif.c"
|
#include "../../../gen/c/gif.c"
|
||||||
|
|
||||||
|
const char* test_filename = "gif/basic.c";
|
||||||
|
|
||||||
void test_default_literal_width() {
|
void test_default_literal_width() {
|
||||||
puffs_gif_lzw_decoder dec;
|
puffs_gif_lzw_decoder dec;
|
||||||
puffs_gif_lzw_decoder_constructor(&dec);
|
puffs_gif_lzw_decoder_constructor(&dec);
|
||||||
|
|||||||
@@ -13,15 +13,28 @@ typedef void (*test)();
|
|||||||
|
|
||||||
test tests[];
|
test tests[];
|
||||||
|
|
||||||
|
const char* test_filename;
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
// The order matters here. Clang also defines "__GNUC__".
|
||||||
|
#if defined(__clang__)
|
||||||
|
const char* cc = "clang";
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
const char* cc = "gcc";
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
const char* cc = "cl";
|
||||||
|
#else
|
||||||
|
const char* cc = "cc";
|
||||||
|
#endif
|
||||||
|
|
||||||
for (test* t = tests; *t; t++) {
|
for (test* t = tests; *t; t++) {
|
||||||
(*t)();
|
(*t)();
|
||||||
if (fail_msg[0]) {
|
if (fail_msg[0]) {
|
||||||
printf("FAIL %s\n", fail_msg);
|
printf("%-16s%-8sFAIL %s\n", test_filename, cc, fail_msg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
tests_run++;
|
tests_run++;
|
||||||
}
|
}
|
||||||
printf("PASS (%d tests run)\n", tests_run);
|
printf("%-16s%-8sPASS (%d tests run)\n", test_filename, cc, tests_run);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user