source: branches/nanovis2/lang/tcl/tests/sysinfo.test @ 3305

Last change on this file since 3305 was 3305, checked in by ldelgass, 11 years ago

sync with trunk

File size: 1.4 KB
Line 
1# Commands covered: Rappture::sysinfo
2#
3# This file contains a collection of tests for one of the Rappture Tcl
4# commands.  Sourcing this file into Tcl runs the tests and
5# generates output for errors.  No output means no errors were found.
6#
7# ======================================================================
8# AUTHOR:  Michael McLennan, Purdue University
9# Copyright (c) 2004-2012  HUBzero Foundation, LLC
10#
11# See the file "license.terms" for information on usage and redistribution
12# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13
14
15if {[lsearch [namespace children] ::tcltest] == -1} {
16    package require tcltest
17    package require Rappture
18    namespace import -force ::tcltest::*
19}
20
21#----------------------------------------------------------
22# Rappture::sysinfo ?<key> <key> ...?
23#----------------------------------------------------------
24test sysinfo-1 {query all system info} {
25    set rval ""
26    foreach {key val} [Rappture::sysinfo] {
27        lappend rval $key
28    }
29} {}
30
31test sysinfo-2 {query just a few parameters} {
32    set info [Rappture::sysinfo uptime freeram totalram]
33    regexp {^[0-9]+ +[0-9]+ +[0-9]+$} $info
34} {1}
35
36test sysinfo-3 {if a key name is not recognized, we get an error} {
37    list [catch {Rappture::sysinfo uptime foo} msg] $msg
38} {1 {bad parameter "foo": should be one of freeram, freeswap, load1, load5, load15, procs, totalram, totalswap, uptime}}
39
40::tcltest::cleanupTests
41return
Note: See TracBrowser for help on using the repository browser.