Merge pull request #853 from echampet/onclick
[mono.git] / mcs / class / Mono.Posix / Test / Mono.Unix / UnixGroupTest.cs
index bef27c9a2b52df4b1c4895aaf3cf10b9026a9481..81e775e64b0d517b962928b2b4bd04301390aabf 100644 (file)
@@ -10,6 +10,7 @@
 
 using NUnit.Framework;
 using System;
+using System.Collections.Generic;
 using System.Configuration;
 using System.Diagnostics;
 
@@ -24,6 +25,7 @@ namespace MonoTests.Mono.Unix {
        public class UnixGroupTest
        {
                [Test]
+               [Category ("AndroidNotWorking")] // API 21 conditionally has setgrent in the NDK headers, but bionic doesn't export it
                public void ListAllGroups_ToString ()
                {
                        try {
@@ -40,13 +42,14 @@ namespace MonoTests.Mono.Unix {
                }
 
                [Test]
-               // According to bug 72293, this may not work:
-               // On systems with NIS, it is possible to have multiple users in the passwd
-               // file with the same name, so the assertion above no longer holds.
-               [Category ("NotWorking")]
+               [Category ("AndroidNotWorking")] // API 21 conditionally has setgrent in the NDK headers, but bionic doesn't export it
                public void ReentrantConstructors ()
                {
+                       var seen = new Dictionary<string, object> ();
                        foreach (UnixGroupInfo group in UnixGroupInfo.GetLocalGroups ()) {
+                               if (seen.ContainsKey (group.GroupName))
+                                       continue;
+                               seen.Add (group.GroupName, null);
                                try {
                                        UnixGroupInfo byName = new UnixGroupInfo (group.GroupName);
                                        UnixGroupInfo byId   = new UnixGroupInfo (group.GroupId);
@@ -64,9 +67,14 @@ namespace MonoTests.Mono.Unix {
                }
 
                [Test]
+               [Category ("AndroidNotWorking")] // API 21 conditionally has setgrent in the NDK headers, but bionic doesn't export it
                public void NonReentrantSyscalls ()
                {
+                       var seen = new Dictionary<string, object> ();
                        foreach (UnixGroupInfo group in UnixGroupInfo.GetLocalGroups ()) {
+                               if (seen.ContainsKey (group.GroupName))
+                                       continue;
+                               seen.Add (group.GroupName, null);
                                try {
                                        Group byName = Syscall.getgrnam (group.GroupName);
                                        Group byId   = Syscall.getgrgid ((uint) group.GroupId);
@@ -90,6 +98,7 @@ namespace MonoTests.Mono.Unix {
                }
 
                [Test]
+               [Category ("AndroidNotWorking")] // API 21 conditionally has getgrnam_r in the NDK headers, but bionic doesn't export it
                public void InvalidGroups_Constructor_Name ()
                {
                        string[] badGroups = new string[]{"i'm bad", "so am i", "does-not-exist"};