← Back to team overview

opencompute-developers team mailing list archive

[Merge] lp:~sophia-wu/opencompute/add-ocp-system-log-job into lp:opencompute/checkbox

 

Sophia Wu has proposed merging lp:~sophia-wu/opencompute/add-ocp-system-log-job into lp:opencompute/checkbox.

Requested reviews:
  Open Compute Developers (opencompute-developers)

For more details, see:
https://code.launchpad.net/~sophia-wu/opencompute/add-ocp-system-log-job/+merge/197006

Add OCP system Log job and it contains the test case that can verify system log entries number > 256. 
-- 
https://code.launchpad.net/~sophia-wu/opencompute/add-ocp-system-log-job/+merge/197006
Your team Open Compute Developers is requested to review the proposed merge of lp:~sophia-wu/opencompute/add-ocp-system-log-job into lp:opencompute/checkbox.
=== added file 'data/whitelists/opencompute-certify-local.whitelist'
--- data/whitelists/opencompute-certify-local.whitelist	1970-01-01 00:00:00 +0000
+++ data/whitelists/opencompute-certify-local.whitelist	2013-11-28 02:11:04 +0000
@@ -0,0 +1,48 @@
+## This whitelist is intended for use inside Canonical's test labs.  The tests
+## conained in this list are the same as those contained in the
+## server-selftest.whitelist file that OEMs may use. The difference here is that
+## some of these tests depend on a specific network environment and may not run
+## properly in your test environment.  To avoid false failures, please use the 
+## server-selftest.whitelist instead.
+# Resource Jobs
+block_device
+cdimage
+cpuinfo
+device
+dmi
+dpkg
+efi
+environment
+gconf
+lsb
+meminfo
+module
+optical_drive
+package
+sleep
+uname
+#Info attachment jobs
+__info__
+cpuinfo_attachment
+dmesg_attachment
+dmi_attachment
+dmidecode_attachment
+efi_attachment
+lspci_attachment
+lshw_attachment
+mcelog_attachment
+meminfo_attachment
+modprobe_attachment
+modules_attachment
+sysctl_attachment
+sysfs_attachment
+udev_attachment
+lsmod_attachment
+acpi_sleep_attachment
+info/hdparm
+info/hdparm_.*.txt
+installer_debug.gz
+info/disk_partitions
+# Actual test cases
+__TC-002-0011-System_Log__
+TC-002-0011-001-System_Log_Entries

=== added file 'jobs/TC-002-0011-System_Log.txt.in'
--- jobs/TC-002-0011-System_Log.txt.in	1970-01-01 00:00:00 +0000
+++ jobs/TC-002-0011-System_Log.txt.in	2013-11-28 02:11:04 +0000
@@ -0,0 +1,7 @@
+plugin: shell
+name: TC-002-0011-001-System_Log_Entries
+requires: package.name == 'dcmitool'
+user: root
+command: dcmi_sel_entries
+description: 1.dcmitool 2.Calculate entries number of system event log 3.A log capable of at least 256 entries
+ 

=== modified file 'jobs/local.txt.in'
--- jobs/local.txt.in	2013-10-01 00:55:26 +0000
+++ jobs/local.txt.in	2013-11-28 02:11:04 +0000
@@ -109,3 +109,11 @@
 command:
  shopt -s extglob
  cat $CHECKBOX_SHARE/jobs/sniff.txt?(.in)
+
+name: __TC-002-0011-System_Log__
+plugin: local
+description: System Event Log
+command:
+  shopt -s extglob
+  cat $CHECKBOX_SHARE/jobs/TC-002-0011-System_Log.txt?(.in)
+

=== added file 'scripts/dcmi_sel_entries'
--- scripts/dcmi_sel_entries	1970-01-01 00:00:00 +0000
+++ scripts/dcmi_sel_entries	2013-11-28 02:11:04 +0000
@@ -0,0 +1,72 @@
+#!/usr/bin/env python3
+"""
+Copyright (C) 2010-2013 by Cloud Computing Center for Mobile Applications 
+Industrial Technology Research Institute
+
+File Name
+  dcmi_sel_entries
+
+Authors
+  Sophia Wu <Sophia.Wu@xxxxxxxxxxx>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3,
+as published by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""
+import sys
+import shlex
+import re
+import subprocess
+from subprocess import (
+    CalledProcessError,
+    check_call,
+    check_output
+)
+
+#Retrieve entries number that already used
+def get_entry_used(output):
+    entry_used = re.search(r'Entries\D*(\d+)', output)
+    return entry_used.group(1)
+
+#Retrieve percentage of entries space which already used
+def get_entry_per(output):
+    entry_per = re.search(r'Percent Used\D*(\d+)', output)
+    return entry_per.group(1)
+
+def main():
+    cmd = "dcmitool sel"
+    
+    try:
+        dcmi_sel_return = check_output(shlex.split(cmd),
+			 stderr=subprocess.STDOUT, universal_newlines=True)
+    except CalledProcessError as command_exception:
+        print("Failed executing dcmi command, Reason:%s." %(command_exception))
+        sys.exit(1)
+
+    #Cauculate total entries number
+    try:
+        entry_space = int(get_entry_used(dcmi_sel_return))\
+			/int(get_entry_per(dcmi_sel_return))*100 
+    except ArithmeticError:
+        print("Arithmetic Error")
+        sys.exit(2)
+
+    if entry_space < 256:
+        print("Entries Number:", int(entry_space), "Entries Number is too least.")
+        sys.exit(3)
+
+    print("Entries Number:%d. Entries Number is more than 256." %(entry_space))
+    sys.exit(0)
+
+if __name__ == "__main__":
+    main()
+


Follow ups