Browse Source

Merge pull request #253 from RyDroid/cppcheck-travis

Adding a test with cppcheck for Travis CI
tags/json-c-0.13-20171207
Eric Haszlakiewicz GitHub 9 years ago
parent
commit
bc3e691a1e
2 changed files with 8 additions and 0 deletions
  1. +6
    -0
      .travis.yml
  2. +2
    -0
      tests/test_util_file.c

+ 6
- 0
.travis.yml View File

@@ -4,6 +4,11 @@ compiler:
- gcc
- clang
addons:
apt:
packages:
- cppcheck
os:
- linux
- osx
@@ -23,3 +28,4 @@ script:
after_success:
- make check
- cppcheck --quiet *.h *.c tests/

+ 2
- 0
tests/test_util_file.c View File

@@ -70,11 +70,13 @@ static void stat_and_cat(const char *file)
if (read(d, buf, sb.st_size) < sb.st_size)
{
printf("FAIL: unable to read all of %s: %s\n", file, strerror(errno));
free(buf);
close(d);
return;
}
buf[sb.st_size] = '\0';
printf("file[%s], size=%d, contents=%s\n", file, (int)sb.st_size, buf);
free(buf);
}

int main(int argc, char **argv)


Loading…
Cancel
Save