diff --git a/appveyor.yml b/support/appveyor.yml similarity index 100% rename from appveyor.yml rename to support/appveyor.yml diff --git a/support/update-converity-branch.py b/support/update-converity-branch.py new file mode 100755 index 00000000..38f189fd --- /dev/null +++ b/support/update-converity-branch.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# Update the coverity branch from the master branch. +# It is not done automatically because Coverity Scan limits +# the number of submissions per day. + +from __future__ import print_function +import shutil, tempfile +from subprocess import check_call + +class Git: + def __init__(self, dir): + self.dir = dir + + def __call__(self, *args): + check_call(['git'] + list(args), cwd=self.dir) + +dir = tempfile.mkdtemp() +try: + git = Git(dir) + git('clone', '-b', 'coverity', 'git@github.com:cppformat/cppformat.git', dir) + git('merge', '-X', 'theirs', '--no-commit', 'origin/master') + git('reset', 'HEAD', '.travis.yml') + git('checkout', '--', '.travis.yml') + git('commit', '-m', 'Update coverity branch') + git('push') +finally: + shutil.rmtree(dir) diff --git a/test/posix-test.cc b/test/posix-test.cc index e4f75257..ace421d4 100644 --- a/test/posix-test.cc +++ b/test/posix-test.cc @@ -166,6 +166,7 @@ TEST(BufferedFileTest, CloseError) { TEST(BufferedFileTest, Fileno) { BufferedFile f; +#ifndef __COVERITY__ // fileno on a null FILE pointer either crashes or returns an error. EXPECT_DEATH_IF_SUPPORTED({ try { @@ -174,6 +175,7 @@ TEST(BufferedFileTest, Fileno) { std::exit(1); } }, ""); +#endif f = open_buffered_file(); EXPECT_TRUE(f.fileno() != -1); File copy = File::dup(f.fileno()); diff --git a/test/printf-test.cc b/test/printf-test.cc index 041fbad1..67ac052e 100644 --- a/test/printf-test.cc +++ b/test/printf-test.cc @@ -295,7 +295,8 @@ void TestLength(const char *length_spec, U value) { fmt::ULongLong unsigned_value = value; // Apply integer promotion to the argument. fmt::ULongLong max = std::numeric_limits::max(); - if (max <= static_cast(std::numeric_limits::max())) { + using fmt::internal::check; + if (check(max <= static_cast(std::numeric_limits::max()))) { signed_value = static_cast(value); unsigned_value = static_cast(value); } else if (max <= std::numeric_limits::max()) { diff --git a/test/test-main.cc b/test/test-main.cc index 350044da..ef412406 100644 --- a/test/test-main.cc +++ b/test/test-main.cc @@ -52,8 +52,8 @@ int main(int argc, char **argv) { _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); - testing::InitGoogleTest(&argc, argv); try { + testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } catch (...) { // Catch all exceptions to make Coverity happy.