forked from github/server
expect remove and unlink to set errno when file doesn't exist, reduce misleading spam.
This commit is contained in:
parent
03a8e0449a
commit
95481211e5
|
@ -22,6 +22,7 @@
|
||||||
#include <tests.h>
|
#include <tests.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
static const struct race * race_with_flag(const char * name) {
|
static const struct race * race_with_flag(const char * name) {
|
||||||
char data[1024];
|
char data[1024];
|
||||||
|
@ -445,7 +446,9 @@ static void test_configs(CuTest * tc)
|
||||||
CuAssertPtrEquals(tc, 0, buildingtypes);
|
CuAssertPtrEquals(tc, 0, buildingtypes);
|
||||||
json_config(json);
|
json_config(json);
|
||||||
CuAssertPtrNotNull(tc, buildingtypes);
|
CuAssertPtrNotNull(tc, buildingtypes);
|
||||||
unlink("test.json");
|
if (unlink("test.json")!=0 && errno==ENOENT) {
|
||||||
|
errno = 0;
|
||||||
|
}
|
||||||
cJSON_Delete(json);
|
cJSON_Delete(json);
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1877,7 +1877,11 @@ int writegame(const char *filename)
|
||||||
join_path(datapath(), filename, path, sizeof(path));
|
join_path(datapath(), filename, path, sizeof(path));
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
/* make sure we don't overwrite an existing file (hard links) */
|
/* make sure we don't overwrite an existing file (hard links) */
|
||||||
unlink(path);
|
if (unlink(path)!=0) {
|
||||||
|
if (errno==ENOENT) {
|
||||||
|
errno = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
F = fopen(path, "wb");
|
F = fopen(path, "wb");
|
||||||
if (!F) {
|
if (!F) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ VALGRIND=`which valgrind`
|
||||||
SERVER=../Debug/eressea/eressea
|
SERVER=../Debug/eressea/eressea
|
||||||
if [ -n "$VALGRIND" ]; then
|
if [ -n "$VALGRIND" ]; then
|
||||||
SUPP=../share/ubuntu-12_04.supp
|
SUPP=../share/ubuntu-12_04.supp
|
||||||
SERVER="$VALGRIND --track-origins=yes --gen-suppressions=all --suppressions=$SUPP --error-exitcode=1 --leak-check=no $SERVER"
|
SERVER="$VALGRIND --track-origins=yes --gen-suppressions=all --suppressions=$SUPP --error-exitcode=1 --leak-check=full $SERVER"
|
||||||
fi
|
fi
|
||||||
echo "running $SERVER"
|
echo "running $SERVER"
|
||||||
$SERVER -t 184 test-turn.lua
|
$SERVER -t 184 test-turn.lua
|
||||||
|
|
Loading…
Reference in New Issue