【已解决】求个正则,希望大神们帮我下;小弟在此谢过了。
本帖最后由 80107671 于 2016-11-25 12:36 编辑以下代码是json文件,求个提取里面的路径,以及路径后面的参数;还有一个运行的超时时间;
例如:
路径:C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\3_PI_Stability_Idle_W\\3_PI_Stability_Idle_W.py
参数: --platform=Purley2S --runtime=00:10:00 --sutExecuteCmd=Serial
超时时间: "36000"{
"cases": [
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\3_PI_Stability_Idle_W\\3_PI_Stability_Idle_W.py --platform=Purley2S --runtime=00:10:00 --sutExecuteCmd=Serial",
"432000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\10_PI_Processor_Prime95_Stress_W\\10_PI_Processor_Prime95_Stress_W.py --platform=Purley2S --runtime=00:10:00 --sutExecuteCmd=Serial",
"36000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\11_PI_Processor_LinPack_Stress_W\\11_PI_Processor_LinPack_Stress_W.py --platform=Purley2S --runtime=01:10:00 --sutExecuteCmd=Serial",
"36000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\17_PI_Powermanagement_ForceShutdown_W\\17_PI_Powermanagement_ForceShutdown_W.py --platform=Purley2S --sutExecuteCmd=Serial",
"8000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\18_PI_Powermanagement_S5HealthCheckStress_W\\18_PI_Powermanagement_S5HealthCheckStress_W.py --platform=Purley2S --target=5 --sutExecuteCmd=Serial",
"8000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\19_PI_Storage_SATAAHCIConfigCheck_W\\19_PI_Storage_SATAAHCIConfigCheck_W.py --platform=Purley2S --sutExecuteCmd=Serial",
"8000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\20_PI_Storage_SATAAHCILinkSpeedCheck_W\\20_PI_Storage_SATAAHCILinkSpeedCheck_W.py --platform=Purley2S --speed=SATA/600 --sutExecuteCmd=Serial",
"8000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\27_PI_Security_TPM_PCR_value_check_General_W\\27_PI_Security_TPM_PCR_value_check_General_W.py --platform=Purley2S --target=3 --sutExecuteCmd=Serial",
"9000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\28_PI_Security_TPM_PCR_value_check_PCR4_W\\28_PI_Security_TPM_PCR_value_check_PCR4_W.py --platform=Purley2S --sutExecuteCmd=Serial",
"5400"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\32_PI_Networking_JacksonVille_DriverInstallUninstall_W\\32_PI_Networking_Jacksonville_DriverInstallUninstall_W.py --platform=Purley2S --inf=C:\\\\BKCPkg\\\\DriverInstall\\\\intel-lan-1GB\\\\NDIS64 --IP=10.239.181.1 --sutExecuteCmd=Serial",
"7000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\33_PI_Networking_JacksonVille_ConnectivityEnableDisable_W\\33_PI_Networking_JacksonVille_ConnectivityEnableDisable_W.py --platform=Purley2S --dhcpip=10.239.181.1 --sutExecuteCmd=Serial",
"5400"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\34_PI_Networking_JacksonVille_ConnectivityReboot_W\\34_PI_Networking_JacksonVille_ConnectivityReboot_W.py --platform=Purley2S --dhcpip=10.239.181.1 --sutExecuteCmd=Serial",
"8000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\35_PI_Networking_JacksonVille_ConnectivityShutdown_W\\35_PI_Networking_JacksonVille_ConnectivityShutdown_W.py --platform=Purley2S --dhcpip=10.239.181.1 --sutExecuteCmd=Serial",
"8000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\36_PI_Networking_JacksonVille_IPv4_W\\36_PI_Networking_JacksonVille_IPv4_W.py --platform=Purley2S --dhcpip=10.239.181.1 --sutExecuteCmd=Serial",
"3600"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\37_PI_Powermanagement_WakeupByPowerbutton_W\\37_PI_Powermanagement_WakeupByPowerbutton_W.py --platform=Purley2S --sutExecuteCmd=Serial",
"3600"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\39_PI_Powermanagement_S4HealthCheckStress_W\\39_PI_Powermanagement_S4HealthCheckStress_W.py --platform=Purley2S --target=5 --sutExecuteCmd=Serial",
"8000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\40_PI_Powermanagement_SxStateTransition_W\\40_PI_Powermanagement_SxStateTransition_W.py --platform=Purley2S --target=5 --sutExecuteCmd=Serial",
"8000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\42_PI_Networking_JacksonVille_ConnectivityHibernation_W\\42_PI_Networking_JacksonVille_ConnectivityHibernation_W.py --platform=Purley2S --dhcpip=10.239.181.1 --sutExecuteCmd=Serial",
"7000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\43_PI_Security_TPM_PCR_value_check_PCR2_W\\43_PI_Security_TPM_PCR_value_check_PCR2_W.py --platform=Purley2S --sutExecuteCmd=Serial",
"5000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\44_PI_Security_TPM_PCR_value_check_PCR5_W\\44_PI_Security_TPM_PCR_value_check_PCR5_W.py --platform=Purley2S --sutExecuteCmd=Serial",
"5000"
],
[
"C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\46_PI_Security_TPM_General_Test_W\\46_PI_Security_TPM_General_Test_W.py --platform=Purley2S --sutExecuteCmd=Serial",
"3600"
],
["C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\29_PI_Security_BitLocker_Encryption_W\\29_PI_Security_BitLocker_Encryption_W.py --platform=Purley2S --sutExecuteCmd=Serial", 8400],
["C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\30_PI_Security_BitLocker_Decryption_W\\30_PI_Security_BitLocker_Decryption_W.py --platform=Purley2S --sutExecuteCmd=Serial", 5400],
["C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\41_PI_Security_TPM_ACPI_table_support_for_TPM_v2.0_W\\41_PI_Security_TPM_ACPI_table_support_for_TPM_v2.0_W.py --platform=Purley2S --sutExecuteCmd=Serial", 5400]
]
} (?<=")\w:[^\h]+|--[^"]+|(?<=")(+)" 回复 2# 水木子
谢谢版主,有一个问题,就是最后三行如果是在一行的话,最后的超时时间匹配不出来。能帮忙再完善下吗?谢谢。。 "(\S+?)\s(-.+?)".*?(\d+) 看大神怎么处理。 回复 4# haijie1223
谢谢小马哥,公司json升级了,呵,帮人帮到底,再帮我完善一下呗。。以下是json内容。后面增加了一个内容;{
"cases": [
["C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\1_PI_Manageability_SPS_Tools_SPSInfo_W\\1_PI_Manageability_SPS_Tools_SPSInfo_W.py --platform=KNL --sutExecuteCmd=Serial --spsversion=3.1.3.12", 3600, "NA"],
["C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\10_PI_Processor_Prime95_Stress_W\\10_PI_Processor_Prime95_Stress_W.py --platform=KNL --sutExecuteCmd=Serial --runtime=08:00:00", 36000, "NA"],
["C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\1000_PI_System_OSautoinstall_W\\1000_PI_System_OSautoinstall_W.py --platform=KNL --sutExecuteCmd=Serial --swurl=https://ubit-artifactory-sh.intel.com/artifactory/DEG-Purley-local/Release/KNL/2016WW19/BKC-KNL_BkcWin_90.80974-2016WW19.zip", 54000, "NA"],
["C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\11_PI_Processor_LinPack_Stress_W\\11_PI_Processor_LinPack_Stress_W.py --platform=KNL --sutExecuteCmd=Serial --runtime=08:00:00", 36000, "NA"],
["C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\18_PI_Powermanagement_S5HealthCheckStress_W\\18_PI_Powermanagement_S5HealthCheckStress_W.py --platform=KNL --sutExecuteCmd=Serial --target=5", 8000, "NA"],
["C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\19_PI_Storage_SATAAHCIConfigCheck_W\\19_PI_Storage_SATAAHCIConfigCheck_W.py --platform=KNL --sutExecuteCmd=Serial", 8000, "Need to add serial port COM101"],
["C:\\BKC\\BKC_Automation\\Scripts\\XPlatformScripts\\Windows\\9_PI_Stress_Runner_threadrunner_s19_W\\9_PI_Stress_Runner_threadrunner_s19_W.py --platform=KNL --sutExecuteCmd=Serial --runtime=01:00:00", 8000, "NA"]
]
}
"(\S+?)\s(-.+?)".*?(\d+).*?"(.+?)" 回复 7# haijie1223
已标上【已解决】 谢谢小马哥!
页:
[1]