From efefcad0f8ef5c373b5e85cef0b3d6a8968bf1dc Mon Sep 17 00:00:00 2001 From: George Fleming Date: Tue, 3 Nov 2015 11:51:59 -0800 Subject: [PATCH 1/2] New xunit tests for domainname and isexecutable --- src/ps_test/test_CorePsPlatform.cs | 41 ++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/src/ps_test/test_CorePsPlatform.cs b/src/ps_test/test_CorePsPlatform.cs index c408c68da..7196862eb 100644 --- a/src/ps_test/test_CorePsPlatform.cs +++ b/src/ps_test/test_CorePsPlatform.cs @@ -88,8 +88,6 @@ namespace PSTests // It should be the same as what our platform code returns Assert.Equal(hostname, Platform.NonWindowsGetMachineName()); } - - } [Fact] @@ -113,8 +111,47 @@ namespace PSTests // It should be the same as what our platform code returns Assert.Equal(hostname, Platform.NonWindowsGetHostName()); } + } + [Fact] + public static void TestGetDomainName() + { + var startInfo = new ProcessStartInfo + { + FileName = @"/usr/bin/env", + Arguments = "dnsdomainname", + RedirectStandardOutput = true, + UseShellExecute = false + }; + using (Process process = Process.Start(startInfo)) + { + // Get output of call to hostname without trailing newline + string domainName = process.StandardOutput.ReadToEnd().Trim(); + process.WaitForExit(); + // The process should return an exit code of 0 on success + Assert.Equal(0, process.ExitCode); + // It should be the same as what our platform code returns + Assert.Equal(domainName, Platform.NonWindowsGetDomainName()); + } + } + + [Fact] + public static void TestIsExecutable() + { + Assert.True(Platform.NonWindowsIsExecutable("/bin/ls")); + } + + [Fact] + public static void TestIsNotExecutable() + { + Assert.False(Platform.NonWindowsIsExecutable("/etc/hosts")); + } + + [Fact] + public static void TestDirectoryIsNotExecutable() + { + Assert.False(Platform.NonWindowsIsExecutable("/etc")); } [Fact] From af00ffc4db7f083a71351eeccc8e382b3723b99a Mon Sep 17 00:00:00 2001 From: George Fleming Date: Tue, 3 Nov 2015 13:55:31 -0800 Subject: [PATCH 2/2] adding submodules --- src/monad | 2 +- src/monad-native | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/monad b/src/monad index 0bbda079b..f6bd69cc0 160000 --- a/src/monad +++ b/src/monad @@ -1 +1 @@ -Subproject commit 0bbda079b92fbd071f0c7ef533eac87653a6a410 +Subproject commit f6bd69cc07c0d564379c684654a3c37b0fbfdaad diff --git a/src/monad-native b/src/monad-native index 9bb5b7e52..102f6163a 160000 --- a/src/monad-native +++ b/src/monad-native @@ -1 +1 @@ -Subproject commit 9bb5b7e52c3f1a18cac367c7fb7579406c6786fc +Subproject commit 102f6163a17afec6e27107ec0fdfec5fd458c706