diff --git a/po/POTFILES.in b/po/POTFILES.in index 358d39c..d37bcf2 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -2,3 +2,4 @@ src/log/normal.c src/string/i18n.c src/core/runner.c +src/io/output.c diff --git a/po/fr.po b/po/fr.po index 6e8fe38..25f40f9 100644 --- a/po/fr.po +++ b/po/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: criterion 2.0.0\n" "Report-Msgid-Bugs-To: franklinmathieu+criterion@gmail.com\n" -"POT-Creation-Date: 2015-11-11 00:24+0100\n" +"POT-Creation-Date: 2015-11-27 12:16+0100\n" "PO-Revision-Date: 2015-04-03 17:58+0200\n" "Last-Translator: \n" "Language-Team: French\n" @@ -185,7 +185,7 @@ msgstr "L'instruction `%1$s` a levé une instance de l'exception `%2$s`." msgid "The statement `%1$s` did not throw an instance of the `%2$s` exception." msgstr "L'instruction `%1$s` n'a pas levé d'instance de l'exception `%2$s`." -#: src/core/runner.c:56 +#: src/core/runner.c:58 #, c-format msgid "" "%1$sWarning! Criterion has detected that it is running under valgrind, but " @@ -196,7 +196,7 @@ msgstr "" "l'option no_early_exit est explicitement désactivée. Les rapports d'erreur " "ne seront pas précis!%2$s\n" -#: src/core/runner.c:60 +#: src/core/runner.c:62 #, c-format msgid "" "%1$sWarning! Criterion has detected that it is running under valgrind, but " @@ -206,3 +206,13 @@ msgstr "" "%1$sAttention! Criterion a détecté qu'il a été lancé avec valgrind, mais le " "nombre de tâches est explicitement défini. Les rapports d'erreur risquent " "d'être déroutants!%2$s\n" + +#: src/io/output.c:12 +#, c-format +msgid "Could not open the file @ `%1$s` for %2$s reporting.\n" +msgstr "Impossible d'ouvrir le fichier `%1$s` pour faire le rapport %2$s.\n" + +#: src/io/output.c:13 +#, c-format +msgid "Writing %1$s report in `%2$s`.\n" +msgstr "Écriture du rapport %1$s dans `%2$s`.\n" diff --git a/src/core/runner.c b/src/core/runner.c index 38a85fc..d5c6a00 100644 --- a/src/core/runner.c +++ b/src/core/runner.c @@ -462,9 +462,8 @@ static int criterion_run_all_tests_impl(struct criterion_test_set *set) { goto cleanup; report(POST_ALL, stats); - log(post_all, stats); - process_all_output(stats); + log(post_all, stats); cleanup: sfree(g_worker_pipe); diff --git a/src/io/output.c b/src/io/output.c index 25831e4..be5dda1 100644 --- a/src/io/output.c +++ b/src/io/output.c @@ -3,6 +3,18 @@ #include #include #include "criterion/output.h" +#include "criterion/logging.h" +#include "string/i18n.h" + +typedef const char *const msg_t; + +#ifdef ENABLE_NLS +static msg_t msg_err = N_("Could not open the file @ `%1$s` for %2$s reporting.\n"); +static msg_t msg_ok = N_("Writing %1$s report in `%2$s`.\n"); +#else +static msg_t msg_err = "Could not open the file @ `%s` for %s reporting.\n"; +static msg_t msg_ok = "Writing %s report in `%s`.\n"; +#endif typedef kvec_t(const char *) str_vec; @@ -69,7 +81,8 @@ void process_all_output(struct criterion_global_stats *stats) { continue; criterion_reporter *report = kh_value(reporters, k); - khint_t ko = kh_get(ht_path, outputs, kh_key(reporters, k)); + const char *name = kh_key(reporters, k); + khint_t ko = kh_get(ht_path, outputs, name); if (ko == kh_end(outputs)) continue; @@ -83,6 +96,12 @@ void process_all_output(struct criterion_global_stats *stats) { else f = fopen(path, "w"); + if (!f) { + criterion_perror(_(msg_err), path, name); + continue; + } + + criterion_pinfo(CRITERION_PREFIX_DASHES, _(msg_ok), name, path); report(f, stats); } }