Permalink
Browse files

Scripts to test a few of the mlog commands in the mlog perl and pytho…

…n libraries.
  • Loading branch information...
1 parent 4d3ddeb commit ac4c249c40d7c45c8d360433db57c37b70490cca @jaredbischof jaredbischof committed Mar 15, 2013
Showing with 56 additions and 0 deletions.
  1. +24 −0 test_scripts/test_mlog_pm_lib.pl
  2. +32 −0 test_scripts/test_mlog_py_lib.py
View
24 test_scripts/test_mlog_pm_lib.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/env perl
+
+use strict;
+use mlog;
+
+init_mlog();
+
+if(logit(5, "mgrast", "my test message", "error code X")) {
+ print "log message sent!\n";
+} else {
+ print "log message not sent.\n";
+}
+
+if(set_log_level(5, "mgrast")) {
+ print "log level changed!\n";
+} else {
+ print "log level not changed.\n";
+}
+
+if(logit(5, "mgrast", "test_msg", "error code Y")) {
+ print "log message sent!\n";
+} else {
+ print "log message not sent.\n";
+}
View
32 test_scripts/test_mlog_py_lib.py
@@ -0,0 +1,32 @@
+#!/soft/packages/python/2.6/bin/python
+
+import os
+import sys
+import re, time
+
+# Getting paths
+MCP_path = os.path.realpath(__file__)
+matchObj = re.match(r'(^.*\/)', MCP_path)
+MCP_dir = matchObj.group(0)
+
+# Adding modules directory to path
+path = list(sys.path)
+sys.path.insert(0, MCP_dir+"mlog_libs/")
+
+from mlog import mlog
+
+m = mlog()
+if(m.logit(5, 'mgrast', 'my test message', 'error code X')):
+ print "log message sent!"
+else:
+ print "log message not sent."
+
+if(m.set_log_level(5, "mgrast")):
+ print "log level changed!";
+else:
+ print "log level not changed.";
+
+if(m.logit(5, "mgrast", "test_msg", "error code Y")):
+ print "log message sent!"
+else:
+ print "log message not sent."

0 comments on commit ac4c249

Please sign in to comment.