From 8f47f5ab814e087d61f1e75049ace79552515679 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 18 Mar 2020 16:08:50 -0700 Subject: [PATCH] Run bsdiff tests in presubmit. Add TEST_MAPPING, and fix /data/tmp (which doesn't exist, and which the code would create itself, meaning that the test only worked if run as root) to /data/local/tmp (which works for the shell user too). Test: treehugger Change-Id: Ib558efc6033bb3aa3410bf8df92fc4f3cd2fc8fe --- TEST_MAPPING | 7 +++++++ test_utils.cc | 7 ++----- 2 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 TEST_MAPPING diff --git a/TEST_MAPPING b/TEST_MAPPING new file mode 100644 index 0000000..598f4c9 --- /dev/null +++ b/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "presubmit": [ + { + "name": "bsdiff_unittest" + } + ] +} diff --git a/test_utils.cc b/test_utils.cc index eb079d5..c1350eb 100644 --- a/test_utils.cc +++ b/test_utils.cc @@ -53,11 +53,8 @@ namespace test_utils { void BsdiffTestEnvironment::SetUp() { #ifdef BSDIFF_TARGET_UNITTEST -#define BSDIFF_TARGET_TMP_BASE "/data/tmp" - if (access(BSDIFF_TARGET_TMP_BASE, F_OK) == -1) { - mkdir(BSDIFF_TARGET_TMP_BASE, S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH); - } - setenv("TMPDIR", BSDIFF_TARGET_TMP_BASE, 1); +#define BSDIFF_TARGET_TMP_BASE "/data/local/tmp" + setenv("TMPDIR", BSDIFF_TARGET_TMP_BASE, 1); #endif // defined (BSDIFF_TARGET_UNITTEST) }