#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
require 5.8.0;
use strict;
use warnings;
# Make sure that Lgrp test is not executed on anything less than 5.8.0,
# as Lgrp is not implemented there
BEGIN {
if ($] < 5.008) {
# Fake one successfull test and exit
exit 0;
}
}
######################################################################
# Tests for Sun::Solaris::Lgrp API.
#
# This is an example script that demonstrates use of Sun::Solaris::Lgrp module.
# It can be used to test the module itself, the liblgrp library or the in-kernel
# implementation.
######################################################################
# Tests to run
# Verify that we can load the module
######################################################################
# Verify that lgrp_init() works.
##
#
######################################################################
######################################################################
# root should have ID 0.
##
#
######################################################################
# Verify lgrp_nlgrps()
##
######################################################################
# All root children should have root as their one and only one parent
##
$fail = 0;
my @parents;
}
######################################################################
# Each lgrp other than root should have a single parent and
# root should have no parents.
##
$fail = 0;
next if $l == $root;
}
#
#######################################################################
######################################################################
# Lgrp affinity tests.
#######################
######################################################################
# lgrp_affinity-set should change home lgrp.
##
SKIP: {
# Pickup any lgrp not equal to the current one.
# Set affinity to the new lgrp.
# Our home should change to a new lgrp.
# Drop affinity to the lgrp.
}
######################################################################
# Should be able to set affinity to any legal value
##
}
#
######################################################################
######################################################################
# Root should have non-zero CPUs and memory size
# Also, its memory size should be consistent with the one reported by
# sysconfig.
##
#
######################################################################
######################################################################
# The cookie should not be stale
#
######################################################################
######################################################################
# Latency should be non-zero.
#
######################################################################
######################################################################
# Verify latency matrix.
##
SKIP: {
my $latencies;
my $min_latency = 10000;
my $max_latency = 0;
my $badlatency = 0;
my $assymetrical = 0;
my $diagonalmin = 0;
my $badself = 0;
my $nlatencies;
$nlatencies++ if $latencies->{$l1}{$l2};
}
}
# There should be at least some lgroups which have latencies.
my @d_lgrps = grep { defined $latencies->{$_}{$_} } @leaves;
# All diagonal latencies should be the same.
my $lat_diag_lgrp = $d_lgrps[0];
my $lat_diag = $latencies->{$lat_diag_lgrp}{$lat_diag_lgrp};
my @badlatencies = grep { $latencies->{$_}{$_} != $lat_diag } @d_lgrps;
my %l_cpus;
my %l_mem;
my $lgrps_nomem;
my $lgrps_nocpus;
$l_mem{$l1} = $c->mem_size($l1, LGRP_MEM_SZ_INSTALLED,
$lgrps_nomem++ unless $l_mem{$l1};
}
# Verify latencies consistency
# Can't get latency if source doesn't have CPUs
my $self_latency = $latencies->{$l1}{$l1};
# Can't get latenciy if destination doesn't have memory
$badlatency++;
next;
}
$max_latency = $latencies->{$l1}{$l2} if
$latencies->{$l1}{$l2} > $max_latency;
$min_latency = $latencies->{$l1}{$l2} if
$latencies->{$l1}{$l2} < $min_latency;
# Latencies should be symmetrical but only if they are valid.
if ($latencies->{$l2}{$l1} &&
}
$self_latency && $self_latency > $latencies->{$l1}{$l2};
}
}
SKIP: {
1 if $lgrps_nomem || $lgrps_nocpus;
}
is($max_latency, $latencies->{$root}{$root},
'Root should have maximum latencies');
}
######################################################################
# Verify lgrp_resources API
##
SKIP: {
$fail = 0;
my $nc = 0;
}
}
#
######################################################################
# THE END!
#########