From f72b748371da2d7ce327a5d15feea46960aa7dd3 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Tue, 2 Oct 2018 00:16:08 +0330 Subject: [PATCH] [circleci] Fix "msan" and "everything" bots (#1205) --- .circleci/config.yml | 13 ++++++------- src/check-symbols.sh | 2 -- test/fuzzing/main.cc | 22 +++++++++------------- test/fuzzing/run-shape-fuzzer-tests.py | 2 -- test/fuzzing/run-subset-fuzzer-tests.py | 2 -- 5 files changed, 15 insertions(+), 26 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 450b62bee..9a0bfe39d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,9 +91,9 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CFLAGS="-Weverything -Werror -fPIC -Wno-unused-parameter -Wno-missing-variable-declarations -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro -Wno-shadow -Wno-reserved-id-macro -Wno-disabled-macro-expansion -Wno-missing-variable-declarations -Wno-unused-macros -Wno-unreachable-code-return" CXXFLAGS="-Weverything -Werror -fPIC -Wno-undef -Wno-deprecated-declarations -Wno-weak-vtables -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make -j32 - - run: make check || .ci/fail.sh + - run: CFLAGS="-Weverything -Wno-unused-parameter -Wno-missing-variable-declarations -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro -Wno-shadow -Wno-reserved-id-macro -Wno-disabled-macro-expansion -Wno-missing-variable-declarations -Wno-unused-macros -Wno-unreachable-code-return" CXXFLAGS="-Weverything -Wno-undef -Wno-deprecated-declarations -Wno-weak-vtables -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: make -j32 CPPFLAGS="-Werror" + - run: make check CPPFLAGS="-Werror" || .ci/fail.sh clang-asan: docker: @@ -121,14 +121,13 @@ jobs: - run: echo "deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdev.list - run: echo "deb-src http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdevsrc.list - run: apt update || true - - run: apt install -y clang lld binutils libtool autoconf automake automake1.11 gtk-doc-tools gettext make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: apt install -y clang lld binutils libtool autoconf automake gtk-doc-tools gettext make pkg-config ragel libcairo2-dev libicu-dev libmount-dev libgraphite2-dev python python-pip - run: pip install fonttools - run: update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.lld" 10 - - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.0.tar.bz2 && tar xf glib-2.28.0.tar.bz2 && cd glib-2.28.0 && ./autogen.sh || true && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. + - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.58/glib-2.58.1.tar.xz && tar xf glib-2.58.1.tar.xz && cd glib-2.58.1 && ./autogen.sh --with-pcre CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --without-icu - - run: make -j32 - - run: MSAN_OPTIONS=exitcode=42 SKIPCHECKSYMBOLS=1 SKIPFUZZERTESTS=1 make check || .ci/fail.sh | asan_symbolize | c++filt + - run: make -j32 && MSAN_OPTIONS=exitcode=42 make check || .ci/fail.sh | asan_symbolize | c++filt clang-tsan: docker: diff --git a/src/check-symbols.sh b/src/check-symbols.sh index d197e8e3c..cea868488 100755 --- a/src/check-symbols.sh +++ b/src/check-symbols.sh @@ -3,8 +3,6 @@ LC_ALL=C export LC_ALL -test -z "$SKIPCHECKSYMBOLS" || exit 77 - test -z "$srcdir" && srcdir=. test -z "$libs" && libs=.libs stat=0 diff --git a/test/fuzzing/main.cc b/test/fuzzing/main.cc index 4692f7b5f..3ff8803ee 100644 --- a/test/fuzzing/main.cc +++ b/test/fuzzing/main.cc @@ -1,21 +1,17 @@ #include "hb-fuzzer.hh" -#include -#include -#include +#include #include -std::string FileToString(const std::string &Path) { - /* TODO This silently passes if file does not exist. Fix it! */ - std::ifstream T(Path.c_str()); - return std::string((std::istreambuf_iterator(T)), - std::istreambuf_iterator()); -} - int main(int argc, char **argv) { + hb_blob_t *blob = hb_blob_create_from_file (argv[1]); + unsigned int len; + const char *font_data = hb_blob_get_data (blob, &len); + for (int i = 1; i < argc; i++) { - std::string s = FileToString(argv[i]); - std::cout << argv[i] << std::endl; - LLVMFuzzerTestOneInput((const unsigned char*)s.data(), s.size()); + printf ("%s\n", argv[i]); + LLVMFuzzerTestOneInput((const uint8_t *) font_data, len); } + + hb_blob_destroy (blob); } diff --git a/test/fuzzing/run-shape-fuzzer-tests.py b/test/fuzzing/run-shape-fuzzer-tests.py index e87cd09df..fea0b01b4 100755 --- a/test/fuzzing/run-shape-fuzzer-tests.py +++ b/test/fuzzing/run-shape-fuzzer-tests.py @@ -4,8 +4,6 @@ from __future__ import print_function, division, absolute_import import sys, os, subprocess -if os.environ.get ("SKIPFUZZERTESTS", "") != "": sys.exit (0) - srcdir = os.environ.get ("srcdir", ".") EXEEXT = os.environ.get ("EXEEXT", "") top_builddir = os.environ.get ("top_builddir", ".") diff --git a/test/fuzzing/run-subset-fuzzer-tests.py b/test/fuzzing/run-subset-fuzzer-tests.py index aa045fed6..013628860 100755 --- a/test/fuzzing/run-subset-fuzzer-tests.py +++ b/test/fuzzing/run-subset-fuzzer-tests.py @@ -4,8 +4,6 @@ from __future__ import print_function, division, absolute_import import sys, os, subprocess -if os.environ.get ("SKIPFUZZERTESTS", "") != "": sys.exit (0) - srcdir = os.environ.get ("srcdir", ".") EXEEXT = os.environ.get ("EXEEXT", "") top_builddir = os.environ.get ("top_builddir", ".")