]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/has_tests.c
Make ccanlint tests all positive: ie. "has _info.c file: FAILED".
[ccan] / tools / ccanlint / has_tests.c
index 320478b38da61424727c093bece2032c55c5528f..efea3c0632d7ec6c7084fef75a5b75f39ee6cb66 100644 (file)
@@ -80,7 +80,7 @@ static void handle_no_tests(struct manifest *m, void *check_result)
        if (!ask("Should I create a template test/run.c file for you?"))
                return;
 
-       if (mkdir("test", 0600) != 0) {
+       if (mkdir("test", 0700) != 0) {
                if (errno != EEXIST)
                        err(1, "Creating test/ directory");
        }
@@ -97,9 +97,9 @@ static void handle_no_tests(struct manifest *m, void *check_result)
        fputs("#include \"tap/tap.h\"\n", run);
        fputs("\n", run);
 
-       fputs("int main(int argc, char *argv[])\n", run);
+       fputs("int main(void)\n", run);
        fputs("{\n", run);
-       fputs("\t/* This is how many tests you plan to run\n", run);
+       fputs("\t/* This is how many tests you plan to run */\n", run);
        fputs("\tplan_tests(3);\n", run);
        fputs("\n", run);
        fputs("\t/* Simple thing we expect to succeed */\n", run);
@@ -116,7 +116,8 @@ static void handle_no_tests(struct manifest *m, void *check_result)
        fputs("#endif\n", run);
        fputs("\n", run);
        fputs("\t/* This exits depending on whether all tests passed */\n", run);
-       fputs("\return exit_status()\n", run);
+       fputs("\treturn exit_status();\n", run);
+       fputs("}\n", run);
 
        fclose(run);
 }