using NUnit.Framework;
using System;
+using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
-using System.Xml;
using Mono.Unix;
+using Group = Mono.Unix.Native.Group;
+using Syscall = Mono.Unix.Native.Syscall;
+
namespace MonoTests.Mono.Unix {
[TestFixture, Category ("NotDotNet")]
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 {
Console.WriteLine ("Listing all groups");
- foreach (UnixGroupInfo group in UnixGroup.GetLocalGroups ()) {
+ foreach (UnixGroupInfo group in UnixGroupInfo.GetLocalGroups ()) {
Console.WriteLine ("\t{0}", group);
}
}
}
[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 ()
{
- foreach (UnixGroupInfo group in UnixGroup.GetLocalGroups ()) {
+ 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);
}
[Test]
+ [Category ("AndroidNotWorking")] // API 21 conditionally has setgrent in the NDK headers, but bionic doesn't export it
public void NonReentrantSyscalls ()
{
- foreach (UnixGroupInfo group in UnixGroup.GetLocalGroups ()) {
+ 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 (group.GroupId);
+ Group byId = Syscall.getgrgid ((uint) group.GroupId);
Assert.IsNotNull (byName, "#TNRS: access by name");
Assert.IsNotNull (byId, "#TNRS: access by gid");
}
[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"};