mirror of
https://github.com/json-c/json-c.git
synced 2026-04-05 05:19:07 +08:00
Adding a test with cppcheck for Travis CI
This commit is contained in:
@@ -4,6 +4,11 @@ compiler:
|
|||||||
- gcc
|
- gcc
|
||||||
- clang
|
- clang
|
||||||
|
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- cppcheck
|
||||||
|
|
||||||
os:
|
os:
|
||||||
- linux
|
- linux
|
||||||
- osx
|
- osx
|
||||||
@@ -23,3 +28,4 @@ script:
|
|||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- make check
|
- make check
|
||||||
|
- cppcheck --quiet *.h *.c tests/
|
||||||
|
|||||||
@@ -70,11 +70,13 @@ static void stat_and_cat(const char *file)
|
|||||||
if (read(d, buf, sb.st_size) < sb.st_size)
|
if (read(d, buf, sb.st_size) < sb.st_size)
|
||||||
{
|
{
|
||||||
printf("FAIL: unable to read all of %s: %s\n", file, strerror(errno));
|
printf("FAIL: unable to read all of %s: %s\n", file, strerror(errno));
|
||||||
|
free(buf);
|
||||||
close(d);
|
close(d);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buf[sb.st_size] = '\0';
|
buf[sb.st_size] = '\0';
|
||||||
printf("file[%s], size=%d, contents=%s\n", file, (int)sb.st_size, buf);
|
printf("file[%s], size=%d, contents=%s\n", file, (int)sb.st_size, buf);
|
||||||
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
|||||||
Reference in New Issue
Block a user