-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test: ./checkbuild.py && ./run_tests.py Bug: android/ndk#976 Change-Id: Ic14955978abb0045a6bdac3e8a91ed5d12693057
- Loading branch information
Showing
16 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cmake_minimum_required(VERSION 3.6.0) | ||
|
||
add_executable(foo jni/foo.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
LOCAL_PATH := $(call my-dir) | ||
|
||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := foo | ||
LOCAL_SRC_FILES := foo.cpp | ||
include $(BUILD_EXECUTABLE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <string.h> | ||
|
||
#if _FORTIFY_SOURCE != 2 | ||
#error Expected _FORTIFY_SOURCE=2 | ||
#endif | ||
|
||
int main(int argc, char** argv) { | ||
const char src[] = "foo bar baz"; | ||
char dst[10]; | ||
strcpy(dst, src); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from typing import Optional | ||
|
||
from ndk.test.types import Test | ||
|
||
|
||
def build_unsupported(test: Test) -> Optional[str]: | ||
if test.config.api is not None and test.config.api < 17: | ||
return f'__strcpy_chk not available in android-{test.config.api}' | ||
return None | ||
|
||
|
||
def is_negative_test() -> bool: | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
LOCAL_PATH := $(call my-dir) | ||
|
||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := fortify_test | ||
LOCAL_SRC_FILES := fortify_test.cpp | ||
LOCAL_STATIC_LIBRARIES := googletest_main | ||
include $(BUILD_EXECUTABLE) | ||
|
||
$(call import-module,third_party/googletest) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
APP_STL := c++_static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <memory.h> | ||
|
||
#include "gtest/gtest.h" | ||
#include "gtest/gtest-death-test.h" | ||
|
||
TEST(fortify, smoke) { | ||
char cs[4]; | ||
char* p = cs; | ||
ASSERT_DEATH(memset(p, 0, 5), | ||
"memset: prevented 5-byte write into 4-byte buffer"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from typing import Optional | ||
|
||
from ndk.test.devices import Device | ||
from ndk.test.types import Test | ||
|
||
|
||
def run_unsupported(test: Test, device: Device) -> Optional[str]: | ||
if test.config.api is not None and test.config.api < 17: | ||
return f'__memset_chk not available in android-{test.config.api}' | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cmake_minimum_required(VERSION 3.6.0) | ||
|
||
add_executable(foo jni/foo.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
LOCAL_PATH := $(call my-dir) | ||
|
||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := foo | ||
LOCAL_SRC_FILES := foo.cpp | ||
include $(BUILD_EXECUTABLE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <string.h> | ||
|
||
#if _FORTIFY_SOURCE != 2 | ||
#error Expected _FORTIFY_SOURCE=2 | ||
#endif | ||
|
||
int main(int argc, char** argv) { | ||
const char src[] = "foo bar baz"; | ||
char dst[10]; | ||
strcpy(dst, src); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from typing import Optional | ||
|
||
from ndk.test.types import Test | ||
|
||
|
||
def build_unsupported(test: Test) -> Optional[str]: | ||
if test.config.api is not None and test.config.api >= 21: | ||
return f'strcpy is caught at build time for android-{test.config.api}' | ||
return None |