当前位置: 技术问答>linux和unix
Linux shell怎样测试.conf文件内容
来源: 互联网 发布时间:2017-01-09
本文导语: #////////////////////////////////////////////////////////////////////////////////////////////////// # File Name : samba.conf # Description : samba test config file # Purpose : # Usage : # # Input : NA # Output : NA # Notice : You can easily edit it with openoffic...
#//////////////////////////////////////////////////////////////////////////////////////////////////
# File Name : samba.conf
# Description : samba test config file
# Purpose :
# Usage :
#
# Input : NA
# Output : NA
# Notice : You can easily edit it with openoffice calc program or MSoffice
#
# Author : look
# E-mail : kui.li@cs3c.com.cn,eeslook@163.com
# Date : 2011-08-12
# Version : 0.0.1
# History : NA
#//////////////////////////////////////////////////////////////////////////////////////////////////
# Here is the rules for the settings:
# Index : Value:numeric, begin with 1, Max=9999? Des: index for items
# CaseID : Value:str, Des: test case id , 0001.001.001.001
# Name : Value:str, Des: name
# Description: Value:str, Des: descriptions for test case
# Specmin : Value:numeric, float is not support now Des: the minimum of spec
# SpecMax : Value:numeric, float is not support now Des: the maximum of spec
# ExpectResult : Value:numeric, float is not support now Des: the expected result
# for test item
# Priority : Value:string[P1,P2,P3,P4,P5] Des: the priority of test case
# CaseStatus : Value:string[P,C,D]=[PROPOSED,CONFIRMED,DISABLED] Des:the status of test case
# Category : Value:string[TBD] Des: the category of test case belong to
# Preaction : Value:string[samba.sh -run pre,ftp.sh -run login,etc] or [none], Des: split by ",", the
# value is testcase's item, the preaction item must be passed to test
# this item.
# RunAction : Value:string Des: run test case script name and arguments
# PAfterAction : Value:string Des: the actions after pass the test
# FAfterAction : Value:string Des: the actions after fail the test
# Estime : Value:string Des: estimated time, HH:MM:SS
# Dependson : Value:string Des: To be define
#
#//////////////////////////////////////////////////////////////////////////////////////////////////
#Index|CASEID|Name|DESCRIPTION|SPEC_MIN|SPEC_MAX|ExpectResult|Priority|CaseStatus|Category|Preaction|RunAction|PAfterAction|FAfterAction|Estime|Dependson|
1|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
2|1.0.0.002|start|start samba service test|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
3|1.0.0.003|stop|stop samba service test|1|1|1|P1|C|SMB|samba.sh -ck start|samba.sh -run smbstop|samba.sh -run PafterAction|samba.sh -run FafterAction|00:00:00|none|
4|1.0.0.004|running|samba service running test(long time testing?)|1|1|1|P2|C|SMB|samba.sh -ck start|samba.sh -run smbrunning|none|none|01:00:00|none|
5|1.0.0.005|FileshareWIN1|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running1|samba.sh -run filesharewithWIN|none|none|00:10:00|none|
6|1.0.0.006|FileshareWIN2|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running2|samba.sh -run filesharewithWIN2|none|none|00:10:00|none|
7|1.0.0.007|FileshareWIN3|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running3|samba.sh -run filesharewithWIN3|none|none|00:10:00|none|
8|1.0.0.008|FileshareWIN4|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running4|samba.sh -run filesharewithWIN4|none|none|00:10:00|none|
9|1.0.0.009|FileshareWIN5|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running5|samba.sh -run filesharewithWIN5|none|none|00:10:00|none|
10|1.0.0.010|start|start samba service test10|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
11|1.0.0.011|start|start samba service test11|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
12|1.0.0.012|start|start samba service test12|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
#=======================================================================================================
13|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
14|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
15|1.0.0.007|FileshareWIN3|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running3|samba.sh -run filesharewithWIN3|none|none|00:10:00|none|
16|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
17|1.0.0.009|FileshareWIN5|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running5|samba.sh -run filesharewithWIN5|none|none|00:10:00|none|
18|1.0.0.010|start|start samba service test10|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
19|1.0.0.011|start|start samba service test11|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
20|1.0.0.005|FileshareWIN1|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running1|samba.sh -run filesharewithWIN|none|none|00:10:00|none|
21|1.0.0.006|FileshareWIN2|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running2|samba.sh -run filesharewithWIN2|none|none|00:10:00|none|
22|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
23|1.0.0.008|FileshareWIN4|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running4|samba.sh -run filesharewithWIN4|none|none|00:10:00|none|
24|1.0.0.009|FileshareWIN5|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running5|samba.sh -run filesharewithWIN5|none|none|00:10:00|none|
25|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
26|1.0.0.011|start|start samba service test11|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
27|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
28|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
29|1.0.0.007|FileshareWIN3|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running3|samba.sh -run filesharewithWIN3|none|none|00:10:00|none|
30|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
31|1.0.0.009|FileshareWIN5|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running5|samba.sh -run filesharewithWIN5|none|none|00:10:00|none|
32|1.0.0.010|start|start samba service test10|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
33|1.0.0.011|start|start samba service test11|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
34|1.0.0.005|FileshareWIN1|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running1|samba.sh -run filesharewithWIN|none|none|00:10:00|none|
35|1.0.0.006|FileshareWIN2|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running2|samba.sh -run filesharewithWIN2|none|none|00:10:00|none|
36|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
37|1.0.0.008|FileshareWIN4|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running4|samba.sh -run filesharewithWIN4|none|none|00:10:00|none|
38|1.0.0.009|FileshareWIN5|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running5|samba.sh -run filesharewithWIN5|none|none|00:10:00|none|
39|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
40|1.0.0.011|start|start samba service test11|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
上面是一个samba.conf文件的内容,现要测试#Index|CASEID|Name|DESCRIPTION|SPEC_MIN|SPEC_MAX|ExpectResult|Priority|CaseStatus|Category|Preaction|RunAction|PAfterAction|FAfterAction|Estime|Dependson|这行及下面40行中 的格式与 内容,如格式是否正确,是不是少了还是多了一个,内容是不是正确的,是不是少了还是多了
请问该怎么测试?本人是个新手,还请帮帮忙了!谢谢!
# File Name : samba.conf
# Description : samba test config file
# Purpose :
# Usage :
#
# Input : NA
# Output : NA
# Notice : You can easily edit it with openoffice calc program or MSoffice
#
# Author : look
# E-mail : kui.li@cs3c.com.cn,eeslook@163.com
# Date : 2011-08-12
# Version : 0.0.1
# History : NA
#//////////////////////////////////////////////////////////////////////////////////////////////////
# Here is the rules for the settings:
# Index : Value:numeric, begin with 1, Max=9999? Des: index for items
# CaseID : Value:str, Des: test case id , 0001.001.001.001
# Name : Value:str, Des: name
# Description: Value:str, Des: descriptions for test case
# Specmin : Value:numeric, float is not support now Des: the minimum of spec
# SpecMax : Value:numeric, float is not support now Des: the maximum of spec
# ExpectResult : Value:numeric, float is not support now Des: the expected result
# for test item
# Priority : Value:string[P1,P2,P3,P4,P5] Des: the priority of test case
# CaseStatus : Value:string[P,C,D]=[PROPOSED,CONFIRMED,DISABLED] Des:the status of test case
# Category : Value:string[TBD] Des: the category of test case belong to
# Preaction : Value:string[samba.sh -run pre,ftp.sh -run login,etc] or [none], Des: split by ",", the
# value is testcase's item, the preaction item must be passed to test
# this item.
# RunAction : Value:string Des: run test case script name and arguments
# PAfterAction : Value:string Des: the actions after pass the test
# FAfterAction : Value:string Des: the actions after fail the test
# Estime : Value:string Des: estimated time, HH:MM:SS
# Dependson : Value:string Des: To be define
#
#//////////////////////////////////////////////////////////////////////////////////////////////////
#Index|CASEID|Name|DESCRIPTION|SPEC_MIN|SPEC_MAX|ExpectResult|Priority|CaseStatus|Category|Preaction|RunAction|PAfterAction|FAfterAction|Estime|Dependson|
1|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
2|1.0.0.002|start|start samba service test|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
3|1.0.0.003|stop|stop samba service test|1|1|1|P1|C|SMB|samba.sh -ck start|samba.sh -run smbstop|samba.sh -run PafterAction|samba.sh -run FafterAction|00:00:00|none|
4|1.0.0.004|running|samba service running test(long time testing?)|1|1|1|P2|C|SMB|samba.sh -ck start|samba.sh -run smbrunning|none|none|01:00:00|none|
5|1.0.0.005|FileshareWIN1|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running1|samba.sh -run filesharewithWIN|none|none|00:10:00|none|
6|1.0.0.006|FileshareWIN2|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running2|samba.sh -run filesharewithWIN2|none|none|00:10:00|none|
7|1.0.0.007|FileshareWIN3|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running3|samba.sh -run filesharewithWIN3|none|none|00:10:00|none|
8|1.0.0.008|FileshareWIN4|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running4|samba.sh -run filesharewithWIN4|none|none|00:10:00|none|
9|1.0.0.009|FileshareWIN5|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running5|samba.sh -run filesharewithWIN5|none|none|00:10:00|none|
10|1.0.0.010|start|start samba service test10|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
11|1.0.0.011|start|start samba service test11|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
12|1.0.0.012|start|start samba service test12|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
#=======================================================================================================
13|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
14|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
15|1.0.0.007|FileshareWIN3|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running3|samba.sh -run filesharewithWIN3|none|none|00:10:00|none|
16|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
17|1.0.0.009|FileshareWIN5|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running5|samba.sh -run filesharewithWIN5|none|none|00:10:00|none|
18|1.0.0.010|start|start samba service test10|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
19|1.0.0.011|start|start samba service test11|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
20|1.0.0.005|FileshareWIN1|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running1|samba.sh -run filesharewithWIN|none|none|00:10:00|none|
21|1.0.0.006|FileshareWIN2|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running2|samba.sh -run filesharewithWIN2|none|none|00:10:00|none|
22|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
23|1.0.0.008|FileshareWIN4|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running4|samba.sh -run filesharewithWIN4|none|none|00:10:00|none|
24|1.0.0.009|FileshareWIN5|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running5|samba.sh -run filesharewithWIN5|none|none|00:10:00|none|
25|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
26|1.0.0.011|start|start samba service test11|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
27|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
28|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
29|1.0.0.007|FileshareWIN3|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running3|samba.sh -run filesharewithWIN3|none|none|00:10:00|none|
30|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
31|1.0.0.009|FileshareWIN5|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running5|samba.sh -run filesharewithWIN5|none|none|00:10:00|none|
32|1.0.0.010|start|start samba service test10|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
33|1.0.0.011|start|start samba service test11|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
34|1.0.0.005|FileshareWIN1|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running1|samba.sh -run filesharewithWIN|none|none|00:10:00|none|
35|1.0.0.006|FileshareWIN2|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running2|samba.sh -run filesharewithWIN2|none|none|00:10:00|none|
36|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
37|1.0.0.008|FileshareWIN4|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running4|samba.sh -run filesharewithWIN4|none|none|00:10:00|none|
38|1.0.0.009|FileshareWIN5|Samba File share with Window test|1|1|1|P1|C|SMB|samba.sh -ck running5|samba.sh -run filesharewithWIN5|none|none|00:10:00|none|
39|1.0.0.001|Install|samba intall test|1|1|1|P1|C|SMB|none|samba.sh -run install|none|none|00:00:00|none|
40|1.0.0.011|start|start samba service test11|1|1|1|P1|C|SMB|samba.sh -ck install|samba.sh -run smbstart|none|none|00:00:00|none|
上面是一个samba.conf文件的内容,现要测试#Index|CASEID|Name|DESCRIPTION|SPEC_MIN|SPEC_MAX|ExpectResult|Priority|CaseStatus|Category|Preaction|RunAction|PAfterAction|FAfterAction|Estime|Dependson|这行及下面40行中 的格式与 内容,如格式是否正确,是不是少了还是多了一个,内容是不是正确的,是不是少了还是多了
请问该怎么测试?本人是个新手,还请帮帮忙了!谢谢!
|
$ grep -A 40 "#Index|CASEID|Name|DESCRIPTION|SPEC_MIN|SPEC_MAX|ExpectResult|Priority|CaseStatus|Category|Preaction|RunAction|PAfterAction|FAfterAction|Estime|Dependson|" samba.conf | awk 'BEGIN{FS="|"}NF!=17&&NR>1{print "line",NR,"error"}'
line 14 error
line 15 error
line 16 error
line 24 error
line 25 error
line 40 error
line 41 error
|