You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jp...@apache.org on 2018/05/30 15:21:54 UTC
[1/2] mesos git commit: Updated `linux/devices` isolator tests for
compiler compatibility.
Repository: mesos
Updated Branches:
refs/heads/master e287647d7 -> 580f82c5b
Updated `linux/devices` isolator tests for compiler compatibility.
The `linux/devices` isolator tests fail to build on on
Ubuntu 14.04 with `gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4)
4.8.4` due to what seems to me a compiler bug, possibly
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57824.
Work around any compiler issues by defining the test cases
in a separate vector so that the copmiler doesn't have any
raw strings in the macro expansion.
Review: https://reviews.apache.org/r/67362/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/419985da
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/419985da
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/419985da
Branch: refs/heads/master
Commit: 419985dad40dfad845a446ec86cc744d7b84d2b5
Parents: e287647
Author: James Peach <jp...@apache.org>
Authored: Wed May 30 07:44:55 2018 -0700
Committer: James Peach <jp...@apache.org>
Committed: Wed May 30 07:44:55 2018 -0700
----------------------------------------------------------------------
.../linux_devices_isolator_tests.cpp | 165 +++++++++----------
1 file changed, 82 insertions(+), 83 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/419985da/src/tests/containerizer/linux_devices_isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/linux_devices_isolator_tests.cpp b/src/tests/containerizer/linux_devices_isolator_tests.cpp
index efaa43b..c807576 100644
--- a/src/tests/containerizer/linux_devices_isolator_tests.cpp
+++ b/src/tests/containerizer/linux_devices_isolator_tests.cpp
@@ -55,12 +55,6 @@ namespace tests {
struct DevicesTestParam
{
- DevicesTestParam(
- const string& _containerCheck,
- const string& _allowedDevices)
- : containerCheck(_containerCheck),
- allowedDevices(_allowedDevices) {}
-
const string containerCheck;
const string allowedDevices;
};
@@ -84,7 +78,8 @@ public:
};
-TEST_P(LinuxDevicesIsolatorTest, ROOT_PopulateWhitelistedDevices)
+TEST_P(LinuxDevicesIsolatorTest,
+ ROOT_UNPRIVILEGED_USER_PopulateWhitelistedDevices)
{
// Verify that all the necessary devices are present on the host.
// All reasonable Linux configuration should have these devices.
@@ -145,86 +140,90 @@ TEST_P(LinuxDevicesIsolatorTest, ROOT_PopulateWhitelistedDevices)
}
-INSTANTIATE_TEST_CASE_P(
- DevicesTestParam,
- LinuxDevicesIsolatorTest,
- ::testing::Values(
- // Test that /dev/loop-control is a character device and that
- // /dev/kmsg doesn't exist. The latter test ensures that we
- // won't succeed by accidentally running on the host.
- DevicesTestParam(
- "test -c /dev/loop-control && test ! -e /dev/kmsg",
- R"~({
- "allowed_devices": [
- {
- "device": {
- "path": "/dev/loop-control"
- },
- "access": {}
- }
- ]
- })~"),
- // Test that a device in a subdirectory is populated.
- DevicesTestParam(
- "test -r /dev/cpu/0/cpuid",
- R"~({
- "allowed_devices": [
- {
- "device": {
- "path": "/dev/cpu/0/cpuid"
- },
- "access": {
- "read": true
- }
+static const std::vector<DevicesTestParam> devicesTestValues {
+ // Test that /dev/loop-control is a character device and that
+ // /dev/kmsg doesn't exist. The latter test ensures that we
+ // won't succeed by accidentally running on the host.
+ DevicesTestParam{
+ "test -c /dev/loop-control && test ! -e /dev/kmsg",
+ R"~({
+ "allowed_devices": [
+ {
+ "device": {
+ "path": "/dev/loop-control"
+ },
+ "access": {}
+ }
+ ]
+ })~"},
+ // Test that a device in a subdirectory is populated.
+ DevicesTestParam{
+ "test -r /dev/cpu/0/cpuid",
+ R"~({
+ "allowed_devices": [
+ {
+ "device": {
+ "path": "/dev/cpu/0/cpuid"
+ },
+ "access": {
+ "read": true
}
- ]
- })~"),
- // Test that read-only devices are populated in read-only mode.
- DevicesTestParam(
- "test -r /dev/loop-control && test ! -w /dev/loop-control",
- R"~({
- "allowed_devices": [
- {
- "device": {
- "path": "/dev/loop-control"
- },
- "access": {
- "read": true
- }
+ }
+ ]
+ })~"},
+ // Test that read-only devices are populated in read-only mode.
+ DevicesTestParam{
+ "test -r /dev/loop-control && test ! -w /dev/loop-control",
+ R"~({
+ "allowed_devices": [
+ {
+ "device": {
+ "path": "/dev/loop-control"
+ },
+ "access": {
+ "read": true
}
- ]
- })~"),
- // Test that write-only devices are populated in write-only mode.
- DevicesTestParam(
- "test -w /dev/loop-control && test ! -r /dev/loop-control",
- R"~({
- "allowed_devices": [
- {
- "device": {
- "path": "/dev/loop-control"
- },
- "access": {
- "write": true
- }
+ }
+ ]
+ })~"},
+ // Test that write-only devices are populated in write-only mode.
+ DevicesTestParam{
+ "test -w /dev/loop-control && test ! -r /dev/loop-control",
+ R"~({
+ "allowed_devices": [
+ {
+ "device": {
+ "path": "/dev/loop-control"
+ },
+ "access": {
+ "write": true
}
- ]
- })~"),
- // Test that read-write devices are populated in read-write mode.
- DevicesTestParam(
- "test -w /dev/loop-control && test -r /dev/loop-control",
- R"~({
- "allowed_devices": [
- {
- "device": {
- "path": "/dev/loop-control"
- },
- "access": {
- "read": true,
- "write": true
- }
+ }
+ ]
+ })~"},
+ // Test that read-write devices are populated in read-write mode.
+ DevicesTestParam{
+ "test -w /dev/loop-control && test -r /dev/loop-control",
+ R"~({
+ "allowed_devices": [
+ {
+ "device": {
+ "path": "/dev/loop-control"
+ },
+ "access": {
+ "read": true,
+ "write": true
}
- ]
- })~")));
+ }
+ ]
+ })~"}
+};
+
+
+INSTANTIATE_TEST_CASE_P(
+ DevicesTestParam,
+ LinuxDevicesIsolatorTest,
+ ::testing::ValuesIn(devicesTestValues));
} // namespace tests {
} // namespace internal {
[2/2] mesos git commit: Switched test devices for the `linux/devices`
isolator tests.
Posted by jp...@apache.org.
Switched test devices for the `linux/devices` isolator tests.
The `cpuid` device is not always available when running tests
in a VM, so switch to `/dev/net/tun`. For the purposes of this
test, is doesn't matter what the device is as long as it is
in a subdirectory.
Review: https://reviews.apache.org/r/67363/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/580f82c5
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/580f82c5
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/580f82c5
Branch: refs/heads/master
Commit: 580f82c5b80415d419c32531eca41d05e58ed236
Parents: 419985d
Author: James Peach <jp...@apache.org>
Authored: Wed May 30 07:44:59 2018 -0700
Committer: James Peach <jp...@apache.org>
Committed: Wed May 30 07:44:59 2018 -0700
----------------------------------------------------------------------
src/tests/containerizer/linux_devices_isolator_tests.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/580f82c5/src/tests/containerizer/linux_devices_isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/linux_devices_isolator_tests.cpp b/src/tests/containerizer/linux_devices_isolator_tests.cpp
index c807576..0d53721 100644
--- a/src/tests/containerizer/linux_devices_isolator_tests.cpp
+++ b/src/tests/containerizer/linux_devices_isolator_tests.cpp
@@ -85,6 +85,7 @@ TEST_P(LinuxDevicesIsolatorTest,
// All reasonable Linux configuration should have these devices.
ASSERT_TRUE(os::exists("/dev/kmsg"));
ASSERT_TRUE(os::exists("/dev/loop-control"));
+ ASSERT_TRUE(os::exists("/dev/net/tun"));
slave::Flags flags = CreateSlaveFlags();
@@ -158,12 +159,12 @@ static const std::vector<DevicesTestParam> devicesTestValues {
})~"},
// Test that a device in a subdirectory is populated.
DevicesTestParam{
- "test -r /dev/cpu/0/cpuid",
+ "test -r /dev/net/tun",
R"~({
"allowed_devices": [
{
"device": {
- "path": "/dev/cpu/0/cpuid"
+ "path": "/dev/net/tun"
},
"access": {
"read": true