Merge "Fix our fortify tests for global -Werror."

This commit is contained in:
Dan Albert 2016-02-03 02:28:42 +00:00 committed by Gerrit Code Review
commit 3e75110bcb
4 changed files with 27 additions and 2 deletions

View File

@ -162,7 +162,7 @@ $(foreach compiler,gcc clang, \
-D_FORTIFY_SOURCE=$(test) \ -D_FORTIFY_SOURCE=$(test) \
-DTEST_NAME=Fortify$(test)_$(compiler)); \ -DTEST_NAME=Fortify$(test)_$(compiler)); \
$(eval fortify$(test)-tests-$(compiler)_src_files := \ $(eval fortify$(test)-tests-$(compiler)_src_files := \
fortify_test.cpp); \ fortify_test_main.cpp); \
$(eval fortify_libs += fortify$(test)-tests-$(compiler)); \ $(eval fortify_libs += fortify$(test)-tests-$(compiler)); \
) \ ) \
) )

View File

@ -5,7 +5,7 @@ PREFIX=$3
shift 3 shift 3
SOURCE=$(echo "$@" | grep -oP '\S+\.cpp\b') SOURCE=$(echo "$@" | grep -oP '\S+\.cpp\b')
OBJ=$(echo "$@" | grep -oP '\S+\.o\b') OBJ=$(echo "$@" | grep -oP '\S+\.o\b')
$CXX "$@" 2>&1 | $FILECHECK -check-prefix=$PREFIX $SOURCE $CXX "$@" -Wno-error 2>&1 | $FILECHECK -check-prefix=$PREFIX $SOURCE
if [ "$?" -eq 0 ]; then if [ "$?" -eq 0 ]; then
touch $OBJ touch $OBJ
else else

View File

@ -14,6 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
// -Werror is on whether we like it or not, and we're intentionally doing awful
// things in this file. GCC is dumb and doesn't have a specific error class for
// the fortify failures (it's just -Werror), so we can't use anything more
// constrained than disabling all the warnings in the file :( It also won't let
// us use system_header in a .cpp file, so we have to #include this from
// fortify_test_main.cpp.
#pragma GCC system_header
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "BionicDeathTest.h" #include "BionicDeathTest.h"

View File

@ -0,0 +1,17 @@
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "fortify_test.cpp"