How to use test_process method in green

Best Python code snippet using green

TC_test.py

Source:TC_test.py Github

copy

Full Screen

1import unittest2import os3import platform4from time import sleep5os_platform = platform.system()6class TC_test(unittest.TestCase):7 @classmethod8 def setUpClass(cls):9 os.system('python ./src/TC14_init.py')10 @classmethod11 def tearDownClass(cls):12 print("")13 def test_TC14_08(self):14 rtn = os.system('python ./src/file_access_control/TC14_08.py')15 self.assertEqual(rtn,0)16 def test_TC14_09(self):17 rtn = os.system('python ./src/file_access_control/TC14_09.py')18 self.assertEqual(rtn,0)19 def test_TC14_10(self):20 rtn = os.system('python ./src/file_access_control/TC14_10.py')21 self.assertEqual(rtn,0)22 def test_TC14_11(self):23 rtn = os.system('python ./src/file_access_control/TC14_11.py')24 self.assertEqual(rtn,0)25 def test_TC14_12_1_create(self):26 rtn = os.system('python ./src/file_access_control/TC14_12_1_create.py')27 self.assertEqual(rtn,0)28 def test_TC14_12_2_write(self):29 rtn = os.system('python ./src/file_access_control/TC14_12_2_write.py')30 self.assertEqual(rtn,0)31 def test_TC14_12_3_read(self):32 rtn = os.system('python ./src/file_access_control/TC14_12_3_read.py')33 self.assertEqual(rtn,0)34 def test_TC14_12_4_rename(self):35 rtn = os.system('python ./src/file_access_control/TC14_12_4_rename.py')36 self.assertEqual(rtn,0)37 def test_TC14_12_5_delete(self):38 rtn = os.system('python ./src/file_access_control/TC14_12_5_delete.py')39 self.assertEqual(rtn,0)40 def test_TC14_12_6_execute(self):41 if os_platform != 'Windows':42 os.system('chmod +x ./test_file/posix/TC14_12_6_execute.sh')43 rtn = os.system('python ./src/file_access_control/TC14_12_6_execute.py')44 self.assertEqual(rtn,0)45 def test_TC14_12_7_mkdir(self):46 rtn = os.system('python ./src/file_access_control/TC14_12_7_mkdir.py')47 self.assertEqual(rtn,0)48 def test_TC14_12_8_rmdir(self):49 rtn = os.system('python ./src/file_access_control/TC14_12_8_rmdir.py')50 self.assertEqual(rtn,0)51 def test_TC14_21(self):52 rtn = os.system('python ./src/file_access_control/TC14_21.py')53 self.assertEqual(rtn,0)54 def test_TC14_22(self):55 rtn = os.system('python ./src/file_access_control/TC14_22.py')56 self.assertEqual(rtn,0)57 def test_TC14_23(self):58 rtn = os.system('python ./src/file_access_control/TC14_23.py')59 self.assertEqual(rtn,0)60 def test_TC14_24(self):61 rtn = os.system('python ./src/file_access_control/TC14_24.py')62 self.assertEqual(rtn,0)63 def test_TC14_25(self):64 rtn = os.system('python ./src/file_access_control/TC14_25.py')65 self.assertEqual(rtn,0)66 def test_TC14_26(self):67 rtn = os.system('python ./src/file_access_control/TC14_26.py')68 self.assertEqual(rtn,0)69 def test_TC14_27(self):70 rtn = os.system('python ./src/file_access_control/TC14_27.py')71 self.assertEqual(rtn,0)72 def test_TC14_30(self):73 rtn = os.system('python ./src/file_access_control/TC14_30.py')74 self.assertEqual(rtn,0)75 def test_TC14_31(self):76 rtn = os.system('python ./src/file_access_control/TC14_31.py')77 self.assertEqual(rtn,0)78 def test_TC14_32(self):79 rtn = os.system('python ./src/file_access_control/TC14_32.py')80 self.assertEqual(rtn,0)81#예외 정책 테스트는 TC14_38 ~ TC14_60 으로 대체82# def test_TC14_33(self):83# rtn = os.system('python ./src/file_access_control/TC14_33.py')84## self.assertEqual(rtn,0)85 86 def test_TC14_34(self):87 rtn = os.system('python ./src/file_access_control/TC14_34.py')88 self.assertEqual(rtn,0)89 90 def test_TC14_35(self):91 rtn = os.system('python ./src/file_access_control/TC14_35.py')92 self.assertEqual(rtn,0)93 def test_TC14_38(self):94 rtn = os.system('python ./src/file_access_control/TC14_38.py')95 self.assertEqual(rtn,0)96 def test_TC14_39(self):97 rtn = os.system('python ./src/file_access_control/TC14_39.py')98 self.assertEqual(rtn,0)99 def test_TC14_40_1_create(self):100 rtn = os.system('python ./src/file_access_control/TC14_40_1_create.py')101 self.assertEqual(rtn,0)102 def test_TC14_40_2_write(self):103 rtn = os.system('python ./src/file_access_control/TC14_40_2_write.py')104 self.assertEqual(rtn,0)105 def test_TC14_40_3_read(self):106 rtn = os.system('python ./src/file_access_control/TC14_40_3_read.py')107 self.assertEqual(rtn,0)108 def test_TC14_40_4_rename(self):109 rtn = os.system('python ./src/file_access_control/TC14_40_4_rename.py')110 self.assertEqual(rtn,0)111 def test_TC14_40_5_delete(self):112 rtn = os.system('python ./src/file_access_control/TC14_40_5_delete.py')113 self.assertEqual(rtn,0)114 def test_TC14_40_6_execute(self):115 if os_platform != 'Windows':116 os.system('chmod +x ./test_file/posix/TC14_40_6_execute/TC14_40_6_execute.sh')117 rtn = os.system('python ./src/file_access_control/TC14_40_6_execute.py')118 self.assertEqual(rtn,0)119 def test_TC14_40_7_mkdir(self):120 rtn = os.system('python ./src/file_access_control/TC14_40_7_mkdir.py')121 self.assertEqual(rtn,0)122 def test_TC14_40_8_rmdir(self):123 rtn = os.system('python ./src/file_access_control/TC14_40_8_rmdir.py')124 self.assertEqual(rtn,0)125 def test_TC14_49(self):126 rtn = os.system('python ./src/file_access_control/TC14_49.py')127 self.assertEqual(rtn,0)128 def test_TC14_50(self):129 rtn = os.system('python ./src/file_access_control/TC14_50.py')130 self.assertEqual(rtn,0)131 def test_TC14_51(self):132 rtn = os.system('python ./src/file_access_control/TC14_51.py')133 self.assertEqual(rtn,0)134 def test_TC14_52(self):135 rtn = os.system('python ./src/file_access_control/TC14_52.py')136 self.assertEqual(rtn,0)137 def test_TC14_53(self):138 rtn = os.system('python ./src/file_access_control/TC14_53.py')139 self.assertEqual(rtn,0)140 def test_TC14_54(self):141 rtn = os.system('python ./src/file_access_control/TC14_54.py')142 self.assertEqual(rtn,0)143 def test_TC14_55(self):144 rtn = os.system('python ./src/file_access_control/TC14_55.py')145 self.assertEqual(rtn,0)146 def test_TC14_58(self):147 rtn = os.system('python ./src/file_access_control/TC14_58.py')148 self.assertEqual(rtn,0)149 def test_TC14_59(self):150 rtn = os.system('python ./src/file_access_control/TC14_59.py')151 self.assertEqual(rtn,0)152 def test_TC14_60(self):153 rtn = os.system('python ./src/file_access_control/TC14_60.py')154 self.assertEqual(rtn,0)155 def test_TC14_60_36(self):156 sleep(10)157 rtn = os.system('python ./src/file_access_control/TC14_36.py')158 self.assertEqual(rtn,0)159 def test_TC14_61(self):160 if os_platform == "Windows":161 os.system('start python src\\tcp_server.py 14610')162 else:163 os.system('python ./src/tcp_server.py 14610 &')164 rtn = os.system('python ./src/tcp_connect_control/TC14_61.py')165 self.assertEqual(rtn,0)166 def test_TC14_62(self):167 if os_platform == "Windows":168 os.system('start python src\\tcp_server.py 14620')169 else:170 os.system('python ./src/tcp_server.py 14620 &')171 rtn = os.system('python ./src/tcp_connect_control/TC14_62.py')172 self.assertEqual(rtn,0)173 def test_TC14_63(self):174 if os_platform == "Windows":175 os.system('start python src\\tcp_server.py 14630')176 else:177 os.system('python ./src/tcp_server.py 14630 &')178 rtn = os.system('python ./src/tcp_connect_control/TC14_63.py')179 self.assertEqual(rtn,0)180 def test_TC14_245(self):181 if os_platform == "Windows":182 os.system('start python src\\tcp_server.py 14245')183 else:184 os.system('python ./src/tcp_server.py 14245 &')185 rtn = os.system('python ./src/tcp_connect_control/TC14_245.py')186 self.assertEqual(rtn,0)187 def test_TC14_64(self):188 if os_platform == "Windows":189 os.system('start python src\\tcp_server.py 14640')190 else:191 os.system('python ./src/tcp_server.py 14640 &')192 rtn = os.system('python ./src/tcp_connect_control/TC14_64.py')193 self.assertEqual(rtn,0)194 def test_TC14_66(self):195 if os_platform == "Windows":196 os.system('start python src\\tcp_server.py 14660')197 else:198 os.system('python ./src/tcp_server.py 14660 &')199 rtn = os.system('python ./src/tcp_connect_control/TC14_66.py')200 self.assertEqual(rtn,0)201 def test_TC14_67(self):202 if os_platform == "Windows":203 os.system('start python src\\tcp_server.py 14670')204 else:205 os.system('python ./src/tcp_server.py 14670 &')206 rtn = os.system('python ./src/tcp_connect_control/TC14_67.py')207 self.assertEqual(rtn,0)208 def test_TC14_68(self):209 if os_platform == "Windows":210 os.system('start python src\\tcp_server.py 14680')211 else:212 os.system('python ./src/tcp_server.py 14680 &')213 rtn = os.system('python ./src/tcp_connect_control/TC14_68.py')214 self.assertEqual(rtn,0)215 def test_TC14_69(self):216 if os_platform == "Windows":217 os.system('start python src\\tcp_server.py 14690')218 else:219 os.system('python ./src/tcp_server.py 14690 &')220 rtn = os.system('python ./src/tcp_connect_control/TC14_69.py')221 self.assertEqual(rtn,0)222 def test_TC14_70(self):223 if os_platform == "Windows":224 os.system('start python src\\tcp_server.py 14700')225 else:226 os.system('python ./src/tcp_server.py 14700 &')227 rtn = os.system('python ./src/tcp_connect_control/TC14_70.py')228 self.assertEqual(rtn,0)229 def test_TC14_71(self):230 if os_platform == "Windows":231 os.system('start python src\\tcp_server.py 14710')232 else:233 os.system('python ./src/tcp_server.py 14710 &')234 rtn = os.system('python ./src/tcp_connect_control/TC14_71.py')235 self.assertEqual(rtn,0)236 def test_TC14_72(self):237 if os_platform == "Windows":238 os.system('start python src\\tcp_server.py 14720')239 else:240 os.system('python ./src/tcp_server.py 14720 &')241 rtn = os.system('python ./src/tcp_connect_control/TC14_72.py')242 self.assertEqual(rtn,0)243 def test_TC14_73(self):244 if os_platform == "Windows":245 os.system('start python src\\tcp_server.py 14730')246 else:247 os.system('python ./src/tcp_server.py 14730 &')248 rtn = os.system('python ./src/tcp_connect_control/TC14_73.py')249 self.assertEqual(rtn,0)250 def test_TC14_74(self):251 if os_platform == "Windows":252 os.system('start python src\\tcp_server.py 14740')253 else:254 os.system('python ./src/tcp_server.py 14740 &')255 rtn = os.system('python ./src/tcp_connect_control/TC14_74.py')256 self.assertEqual(rtn,0)257 def test_TC14_75(self):258 if os_platform == "Windows":259 os.system('start test_process\\windows\\TC14_75_sleep.exe')260 else:261 os.system('chmod +x ./test_process/posix/TC14_75_sleep')262 os.system('./test_process/posix/TC14_75_sleep &')263 rtn = os.system('python ./src/process_kill_control/TC14_75.py')264 self.assertEqual(rtn,0)265 def test_TC14_76(self):266 if os_platform == "Windows":267 os.system('start test_process\\windows\\TC14_76_sleep.exe')268 else:269 os.system('chmod +x ./test_process/posix/TC14_76_sleep')270 os.system('./test_process/posix/TC14_76_sleep &')271 rtn = os.system('python ./src/process_kill_control/TC14_76.py')272 self.assertEqual(rtn,0)273 def test_TC14_77(self):274 if os_platform == "Windows":275 os.system('start test_process\\windows\\TC14_77_sleep.exe')276 else:277 os.system('chmod +x ./test_process/posix/TC14_77_sleep')278 os.system('./test_process/posix/TC14_77_sleep &')279 rtn = os.system('python ./src/process_kill_control/TC14_77.py')280 self.assertEqual(rtn,0)281 def test_TC14_78(self):282 if os_platform == "Windows":283 os.system('start test_process\\windows\\TC14_78_sleep.exe')284 else:285 os.system('chmod +x ./test_process/posix/TC14_78_sleep')286 os.system('./test_process/posix/TC14_78_sleep &')287 rtn = os.system('python ./src/process_kill_control/TC14_78.py')288 self.assertEqual(rtn,0)289 def test_TC14_79(self):290 if os_platform == "Windows":291 os.system('start test_process\\windows\\TC14_79_sleep.exe')292 else:293 os.system('chmod +x ./test_process/posix/TC14_79_sleep')294 os.system('./test_process/posix/TC14_79_sleep &')295 rtn = os.system('python ./src/process_kill_control/TC14_79.py')296 self.assertEqual(rtn,0)297 def test_TC14_80(self):298 if os_platform == "Windows":299 os.system('start test_process\\windows\\TC14_80_sleep.exe')300 else:301 os.system('chmod +x ./test_process/posix/TC14_80_sleep')302 os.system('./test_process/posix/TC14_80_sleep &')303 rtn = os.system('python ./src/process_kill_control/TC14_80.py')304 self.assertEqual(rtn,0)305 def test_TC14_81(self):306 if os_platform == "Windows":307 os.system('start test_process\\windows\\TC14_81_sleep.exe')308 else:309 os.system('chmod +x ./test_process/posix/TC14_81_sleep')310 os.system('./test_process/posix/TC14_81_sleep &')311 rtn = os.system('python ./src/process_kill_control/TC14_81.py')312 self.assertEqual(rtn,0)313 def test_TC14_82(self):314 if os_platform == "Windows":315 os.system('start test_process\\windows\\TC14_82_sleep.exe')316 else:317 os.system('chmod +x ./test_process/posix/TC14_82_sleep')318 os.system('./test_process/posix/TC14_82_sleep &')319 rtn = os.system('python ./src/process_kill_control/TC14_82.py')320 self.assertEqual(rtn,0)321 def test_TC14_83(self):322 if os_platform == "Windows":323 os.system('start test_process\\windows\\TC14_83_sleep.exe')324 else:325 os.system('chmod +x ./test_process/posix/TC14_83_sleep')326 os.system('./test_process/posix/TC14_83_sleep &')327 rtn = os.system('python ./src/process_kill_control/TC14_83.py')328 self.assertEqual(rtn,0)329 def test_TC14_84(self):330 if os_platform == "Windows":331 os.system('start test_process\\windows\\TC14_84_sleep.exe')332 else:333 os.system('chmod +x ./test_process/posix/TC14_84_sleep')334 os.system('./test_process/posix/TC14_84_sleep &')335 rtn = os.system('python ./src/process_kill_control/TC14_84.py')336 self.assertEqual(rtn,0)337 def test_TC14_85(self):338 if os_platform == "Windows":339 os.system('start test_process\\windows\\TC14_85_sleep.exe')340 else:341 os.system('chmod +x ./test_process/posix/TC14_85_sleep')342 os.system('./test_process/posix/TC14_85_sleep &')343 rtn = os.system('python ./src/process_kill_control/TC14_85.py')344 self.assertEqual(rtn,0)345 def test_TC14_88(self):346 if os_platform == "Windows":347 os.system('start test_process\\windows\\TC14_88_sleep.exe')348 else:349 os.system('chmod +x ./test_process/posix/TC14_88_sleep')350 os.system('./test_process/posix/TC14_88_sleep &')351 rtn = os.system('python ./src/process_kill_control/TC14_88.py')352 self.assertEqual(rtn,0)353 def test_TC14_89(self):354 if os_platform == "Windows":355 os.system('start test_process\\windows\\TC14_89_sleep.exe')356 else:357 os.system('chmod +x ./test_process/posix/TC14_89_sleep')358 os.system('./test_process/posix/TC14_89_sleep &')359 rtn = os.system('python ./src/process_kill_control/TC14_89.py')360 self.assertEqual(rtn,0)361 def test_TC14_90(self):362 if os_platform == "Windows":363 os.system('start test_process\\windows\\TC14_90_sleep.exe')364 else:365 os.system('chmod +x ./test_process/posix/TC14_90_sleep')366 os.system('./test_process/posix/TC14_90_sleep &')367 rtn = os.system('python ./src/process_kill_control/TC14_90.py')368 self.assertEqual(rtn,0)369 def test_TC14_91(self):370 if os_platform == "Windows":371 os.system('start test_process\\windows\\TC14_91_sleep.exe')372 else:373 os.system('chmod +x ./test_process/posix/TC14_91_sleep')374 os.system('./test_process/posix/TC14_91_sleep &')375 rtn = os.system('python ./src/process_kill_control/TC14_91.py')376 self.assertEqual(rtn,0)377 def test_TC14_92(self):378 if os_platform == "Windows":379 os.system('start test_process\\windows\\TC14_92_sleep.exe')380 else:381 os.system('chmod +x ./test_process/posix/TC14_92_sleep')382 os.system('./test_process/posix/TC14_92_sleep &')383 rtn = os.system('python ./src/process_kill_control/TC14_92.py')384 self.assertEqual(rtn,0)385 def test_TC14_93(self):386 if os_platform == "Windows":387 os.system('start test_process\\windows\\TC14_93_sleep.exe')388 else:389 os.system('chmod +x ./test_process/posix/TC14_93_sleep')390 os.system('./test_process/posix/TC14_93_sleep &')391 rtn = os.system('python ./src/process_kill_control/TC14_93.py')392 self.assertEqual(rtn,0)393 394 def test_TC14_100(self):395 if os_platform == "Windows":396 self.skipTest("skip")397 else:398 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_100')399 rtn = os.system('python ./src/setuid_file_access_control/TC14_100.py')400 self.assertEqual(rtn,0)401 def test_TC14_101(self):402 if os_platform == "Windows":403 self.skipTest("skip")404 else:405 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_101')406 rtn = os.system('python ./src/setuid_file_access_control/TC14_101.py')407 self.assertEqual(rtn,0)408 def test_TC14_102(self):409 if os_platform == "Windows":410 self.skipTest("skip")411 else:412 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_102')413 rtn = os.system('python ./src/setuid_file_access_control/TC14_102.py')414 self.assertEqual(rtn,0)415 def test_TC14_103(self):416 if os_platform == "Windows":417 self.skipTest("skip")418 else:419 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_103')420 rtn = os.system('python ./src/setuid_file_access_control/TC14_103.py')421 self.assertEqual(rtn,0)422 def test_TC14_104_1_create(self):423 if os_platform == "Windows":424 self.skipTest("skip")425 else:426 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_104_1_create')427 rtn = os.system('python ./src/setuid_file_access_control/TC14_104_1_create.py')428 self.assertEqual(rtn,0)429 def test_TC14_104_2_write(self):430 if os_platform == "Windows":431 self.skipTest("skip")432 else:433 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_104_2_write')434 rtn = os.system('python ./src/setuid_file_access_control/TC14_104_2_write.py')435 self.assertEqual(rtn,0)436 def test_TC14_104_3_read(self):437 if os_platform == "Windows":438 self.skipTest("skip")439 else:440 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_104_3_read')441 rtn = os.system('python ./src/setuid_file_access_control/TC14_104_3_read.py')442 self.assertEqual(rtn,0)443 def test_TC14_104_4_rename(self):444 if os_platform == "Windows":445 self.skipTest("skip")446 else:447 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_104_4_rename')448 rtn = os.system('python ./src/setuid_file_access_control/TC14_104_4_rename.py')449 self.assertEqual(rtn,0)450 def test_TC14_104_5_delete(self):451 if os_platform == "Windows":452 self.skipTest("skip")453 else:454 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_104_5_delete')455 rtn = os.system('python ./src/setuid_file_access_control/TC14_104_5_delete.py')456 self.assertEqual(rtn,0)457 def test_TC14_104_6_execute(self):458 if os_platform == "Windows":459 self.skipTest("skip")460 else:461 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_104_6_execute.sh')462 rtn = os.system('python ./src/setuid_file_access_control/TC14_104_6_execute.py')463 self.assertEqual(rtn,0)464 def test_TC14_110(self):465 if os_platform == "Windows":466 self.skipTest("skip")467 else:468 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_110')469 rtn = os.system('python ./src/setuid_file_access_control/TC14_110.py')470 self.assertEqual(rtn,0)471 def test_TC14_111(self):472 if os_platform == "Windows":473 self.skipTest("skip")474 else:475 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_111')476 rtn = os.system('python ./src/setuid_file_access_control/TC14_111.py')477 self.assertEqual(rtn,0)478 def test_TC14_112(self):479 if os_platform == "Windows":480 self.skipTest("skip")481 else:482 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_112')483 rtn = os.system('python ./src/setuid_file_access_control/TC14_112.py')484 self.assertEqual(rtn,0)485 def test_TC14_113(self):486 if os_platform == "Windows":487 self.skipTest("skip")488 else:489 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_113')490 rtn = os.system('python ./src/setuid_file_access_control/TC14_113.py')491 self.assertEqual(rtn,0)492 def test_TC14_114(self):493 if os_platform == "Windows":494 self.skipTest("skip")495 else:496 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_114')497 rtn = os.system('python ./src/setuid_file_access_control/TC14_114.py')498 self.assertEqual(rtn,0)499 def test_TC14_115(self):500 if os_platform == "Windows":501 self.skipTest("skip")502 else:503 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_115')504 rtn = os.system('python ./src/setuid_file_access_control/TC14_115.py')505 self.assertEqual(rtn,0)506 def test_TC14_116(self):507 if os_platform == "Windows":508 self.skipTest("skip")509 else:510 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_116')511 rtn = os.system('python ./src/setuid_file_access_control/TC14_116.py')512 self.assertEqual(rtn,0)513 def test_TC14_119(self):514 if os_platform == "Windows":515 self.skipTest("skip")516 else:517 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_119')518 rtn = os.system('python ./src/setuid_file_access_control/TC14_119.py')519 self.assertEqual(rtn,0)520 def test_TC14_120(self):521 if os_platform == "Windows":522 self.skipTest("skip")523 else:524 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_120')525 rtn = os.system('python ./src/setuid_file_access_control/TC14_120.py')526 self.assertEqual(rtn,0)527 def test_TC14_121(self):528 if os_platform == "Windows":529 self.skipTest("skip")530 else:531 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_121')532 rtn = os.system('python ./src/setuid_file_access_control/TC14_121.py')533 self.assertEqual(rtn,0)534 def test_TC14_122(self):535 if os_platform == "Windows":536 self.skipTest("skip")537 else:538 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_122')539 rtn = os.system('python ./src/setuid_file_access_control/TC14_122.py')540 self.assertEqual(rtn,0)541 def test_TC14_123(self):542 if os_platform == "Windows":543 self.skipTest("skip")544 else:545 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_123')546 rtn = os.system('python ./src/setuid_file_access_control/TC14_123.py')547 self.assertEqual(rtn,0)548 def test_TC14_124(self):549 if os_platform == "Windows":550 self.skipTest("skip")551 else:552 os.system('chmod u+xs /home/jenkins/sharedspace/DBSAFER_OS/TC_Test/test_file/posix/TC14_124')553 rtn = os.system('python ./src/setuid_file_access_control/TC14_124.py')554 self.assertEqual(rtn,0)555 def test_TC14_131(self):556 rtn = os.system('python ./src/port_bind_control/TC14_131.py')557 self.assertEqual(rtn,0)558 def test_TC14_132(self):559 rtn = os.system('python ./src/port_bind_control/TC14_132.py')560 self.assertEqual(rtn,0)561 def test_TC14_133(self):562 rtn = os.system('python ./src/port_bind_control/TC14_133.py')563 self.assertEqual(rtn,0)564 def test_TC14_134(self):565 rtn = os.system('python ./src/port_bind_control/TC14_134.py')566 self.assertEqual(rtn,0)567 def test_TC14_135(self):568 rtn = os.system('python ./src/port_bind_control/TC14_135.py')569 self.assertEqual(rtn,0)570 def test_TC14_136(self):571 rtn = os.system('python ./src/port_bind_control/TC14_136.py')572 self.assertEqual(rtn,0)573 def test_TC14_137(self):574 rtn = os.system('python ./src/port_bind_control/TC14_137.py')575 self.assertEqual(rtn,0)576 def test_TC14_138(self):577 rtn = os.system('python ./src/port_bind_control/TC14_138.py')578 self.assertEqual(rtn,0)579 def test_TC14_139(self):580 rtn = os.system('python ./src/port_bind_control/TC14_139.py')581 self.assertEqual(rtn,0)582 def test_TC14_140(self):583 rtn = os.system('python ./src/port_bind_control/TC14_140.py')584 self.assertEqual(rtn,0)585 def test_TC14_141(self):586 rtn = os.system('python ./src/port_bind_control/TC14_141.py')587 self.assertEqual(rtn,0)588 def test_TC14_142(self):589 rtn = os.system('python ./src/port_bind_control/TC14_142.py')590 self.assertEqual(rtn,0)591 def test_TC14_143(self):592 rtn = os.system('python ./src/port_bind_control/TC14_143.py')593 self.assertEqual(rtn,0)594 def test_TC14_144(self):595 rtn = os.system('python ./src/port_bind_control/TC14_144.py')596 self.assertEqual(rtn,0)597 def test_TC14_145(self):598 rtn = os.system('python ./src/port_bind_control/TC14_145.py')599 self.assertEqual(rtn,0)600 def test_TC14_146(self):601 rtn = os.system('python ./src/port_bind_control/TC14_146.py')602 self.assertEqual(rtn,0)603 def test_TC14_147(self):604 rtn = os.system('python ./src/port_bind_control/TC14_147.py')605 self.assertEqual(rtn,0)606 def test_TC14_150(self):607 rtn = os.system('python ./src/port_bind_control/TC14_150.py')608 self.assertEqual(rtn,0)609 def test_TC14_151(self):610 rtn = os.system('python ./src/port_bind_control/TC14_151.py')611 self.assertEqual(rtn,0)612 def test_TC14_152(self):613 rtn = os.system('python ./src/port_bind_control/TC14_152.py')614 self.assertEqual(rtn,0)615 def test_TC14_153(self):616 rtn = os.system('python ./src/port_bind_control/TC14_153.py')...

Full Screen

Full Screen

parser_tests.py

Source:parser_tests.py Github

copy

Full Screen

1from src.ast_builder import ASTBuilder2from src.vector_generation import create_similarity_vector, create_occurrence_list3def test_process(text):4 ast_builder = ASTBuilder()5 tokens = ast_builder.parse(text)6 print("Similarity Vector: {}".format(create_similarity_vector(create_occurrence_list(tokens), create_occurrence_list(tokens))))7text = """8PROGRAM main9VAR_INPUT10i : INT;11MIN_TIME_MS : TIME := t#1s; 12END_VAR13foo(x.y.z);14foo(x.y.z());15i.j.k:=x.y.z[v+1];16Swap_Byte2 := DWORD#16#FF00FF00;17END_PROGRAM"""18test_process(text)19text = """20PROGRAM main21VAR_INPUT22i : INT;23END_VAR24i.j.k:=x.y[4];25END_PROGRAM"""26test_process(text)27##############28text = """29PROGRAM main30VAR_INPUT31i : INT;32END_VAR33x.y := 0;34u.v := 3;35END_PROGRAM"""36test_process(text)37##############38text = """39PROGRAM main40VAR_INPUT41i : INT;42S1 : BYTE := 2#1111_1111;43END_VAR44i := 4;45REPEAT46i := i + 1;47UNTIL i < j+448END_REPEAT;49END_PROGRAM"""50test_process(text)51##############52text = """53PROGRAM main54FOR i := 0 TO 10 DO55avg := avg[3].x + 4;56END_FOR;57FOR i := func(3) TO 10 DO58avg := avg[3].x + 4;59EXIT;60END_FOR;61END_PROGRAM62"""63test_process(text)64##############65text = """66PROGRAM main67VAR_INPUT68i : INT;69END_VAR70avg := 0;71i := 0;72WHILE (i < 5) DO73avg := avg + f[i];74i := i + 1;75END_WHILE;76avg := avg / 5;77END_PROGRAM"""78test_process(text)79##############80text = """81PROGRAM main82VAR_INPUT83i : INT;84END_VAR85i := 3 + f[5];86END_PROGRAM"""87test_process(text)88##############89text = """90PROGRAM main91VAR_INPUT92i : INT;93END_VAR94IF (a = 1) THEN95i := 3;96END_IF;97END_PROGRAM"""98test_process(text)99##############100text = """101PROGRAM main102VAR_INPUT103i : INT;104a : INT;105b : BOOL;106END_VAR107IF NOT init THEN108 init := TRUE;109 last_check := tx - t#100ms;110END_IF;111x := _BYTE_TO_INT(scene AND BYTE#2#0000_1111);112END_PROGRAM"""113test_process(text)114##############115text = """116PROGRAM main117VAR_INPUT118i : INT;119a : INT;120b : BOOL;121END_VAR122IF (a) THEN123i := 3;124END_IF;125END_PROGRAM"""126test_process(text)127##############128text = """129PROGRAM main130VAR_INPUT131i : INT;132END_VAR133IF (a = 1 AND b = 3 OR c = 5) THEN134i := 3;135END_IF;136END_PROGRAM"""137test_process(text)138##############139text = """140PROGRAM main141VAR_INPUT142i : INT;143END_VAR144IF (a = 1) THEN145 i := 3;146ELSE147 x := 0;148END_IF;149END_PROGRAM"""150test_process(text)151##############152text = """153PROGRAM main154VAR_INPUT155i : INT;156END_VAR157IF (a = 1) THEN158 x := 1;159ELSIF (b = 1) THEN160 y := 1;161ELSE162 x := 0;163 y := 0;164 z := 0;165END_IF;166END_PROGRAM"""167test_process(text)168##############169text = """170PROGRAM main171VAR_INPUT172i : INT;173END_VAR174IF (a = 1) THEN175 x := 1;176ELSIF (b = 1 AND t = 1) THEN177 y := 1;178 IF (000/02 = 0) THEN179 z := 1;180 END_IF;181ELSE182 x := 0;183 y := 0;184 z := 0;185END_IF;186END_PROGRAM"""187##############188text = """189PROGRAM main190VAR_INPUT191i : INT;192END_VAR193CASE state OF1940: IF (green_EW)THEN195 state :=1;196 END_IF;1971: IF (yellow_EW) THEN198 state :=2;199 END_IF;2002: IF (green_NS) THEN201 state :=3;202 END_IF;203END_CASE;204END_PROGRAM"""205test_process(text)206##############207text = """208PROGRAM main209VAR_INPUT210i : INT;211END_VAR212CASE state OF2131..7: x := 3;214END_CASE;215END_PROGRAM"""216test_process(text)217##############218text = """219PROGRAM main220VAR_INPUT221i : INT;222END_VAR223CASE state OF2240: IF (green_EW)THEN225 state :=1;226 END_IF;2271: IF (yellow_EW) THEN228 state :=2;229 END_IF;2302: IF (green_NS) THEN231 state :=3;232 END_IF;233END_CASE;234END_PROGRAM"""235test_process(text)236##############237text = """238PROGRAM main239VAR_INPUT240i : INT;241END_VAR242x := foo();243END_PROGRAM"""244test_process(text)245##############246text = """247PROGRAM main248VAR_INPUT249i : INT;250END_VAR251x := foo(3);252x := foo(3, i);253END_PROGRAM"""254test_process(text)255##############256text = """257PROGRAM main258VAR_INPUT259i : INT;260END_VAR261ramp(OUT := 3);262ramp(OUT := 4, RUN := 1);263END_PROGRAM"""264test_process(text)265##############266text = """267PROGRAM main268VAR_INPUT269i : INT;270END_VAR271(* adjust position if end switch is active *)272IF SWITCH_AVAIL AND END_POS THEN273 POS := SEL_BYTE(POS > BYTE#127, BYTE#0, BYTE#255);274 next_cal := tx + T_CAL;275END_IF;276END_PROGRAM"""277test_process(text)278##############279text = """280PROGRAM main281VAR_INPUT282i : INT;283END_VAR284(* adjust position if end switch is active *)285IF SWITCH_AVAIL AND END_POS THEN286 POS := SEL_BYTE(X := POS > BYTE#127, BYTE#0, BYTE#255);287 next_cal := tx + T_CAL;288END_IF;289END_PROGRAM"""290test_process(text)291##############292text = """293PROGRAM main294VAR_INPUT295i : INT;296END_VAR297(* adjust position if end switch is active *)298IF SWITCH_AVAIL AND END_POS THEN299 POS := SEL_BYTE(X := POS + BYTE#127 * 4, BYTE#0, BYTE#255+7);300 next_cal := tx + T_CAL;301END_IF;302END_PROGRAM"""303test_process(text)304##############305text = """306PROGRAM main307VAR_INPUT308i : INT;309END_VAR310(* adjust position if end switch is active *)311IF DINT_TO_TIME(ABS(TIME_TO_DINT(ramp.TR) - TIME_TO_DINT(ramp.TF)) * DINT#10) > T_RUN THEN error := TRUE; END_IF;312END_PROGRAM"""313test_process(text)314##############315text = """316PROGRAM main317VAR_INPUT318i : INT;319END_VAR320(* adjust position if end switch is active *)321 IF (self_act_cycle > T#0s) AND (tx >= 5) THEN322 END_IF;323END_PROGRAM"""324test_process(text)325##############326text = """327PROGRAM main328VAR_INPUT329i : INT;330END_VAR331(* adjust position if end switch is active *)332IF (status > BYTE#0 AND status < BYTE#100) THEN 333 RETURN;334END_IF;335END_PROGRAM"""336test_process(text)337##############338text = """339PROGRAM main340VAR_INPUT341i : INT;342END_VAR343(* adjust position if end switch is active *)344timer1(in := flame AND in AND motor AND coil1 AND NOT coil2, SECONDS := runtime1, CYCLES := cycles);345timer2(in := flame AND in AND motor AND coil1 AND coil2, SECONDS := runtime2, CYCLES := cycles2);346END_PROGRAM"""347test_process(text)348##############349text = """350PROGRAM main351VAR_INPUT352i : INT;353END_VAR354(* adjust position if end switch is active *)355timer2(in := flame AND in AND motor AND coil1 AND coil2, SECONDS := runtime2, CYCLES := cycles2);356END_PROGRAM"""357test_process(text)358##############359text = """360FUNCTION WATER_DENSITY:REAL361WATER_DENSITY := (999.83952 + 16.952577*T + -7.9905127E-3*T2 + -4.6241757E-5*T2*T + 1.0584601E-7*T4 + -2.8103006E-10*T4*T) / (1.0 + 0.0168872*T);362END_FUNCTION"""363test_process(text)364##############365text = """366PROGRAM main367IF (tx - last) >= T2 THEN368 (* timeout for long pulse if second click did not occur or in stays high *)369 Q := FALSE;370END_IF;371END_PROGRAM"""372test_process(text)373##############374text = """375PROGRAM main376cmp:="ab";377cmp:='ab';378END_PROGRAM"""379test_process(text)380##############381text = """382PROGRAM main383SWIL := LW.Y; // [mm]384NOL := (SWP_1.FulRolLen - SWIL) * 0.5;385END_PROGRAM"""386test_process(text)387##############388text = """389PROGRAM main390VAR_INPUT391 X : ARRAY[0..3] OF BYTE; (* scan line inputs *)392 L : ARRAY[0..3] OF BYTE; (* scan line status *)393 _temp AT temp : ARRAY[0..7] OF BOOL;394 y2, y3, y4 : BOOL;395END_VAR396avg := 0;397i := 0;398END_PROGRAM"""399test_process(text)400##############401text = """402PROGRAM main403STRING_TO_URL.STR:="http://ipinfodb.com/ip_query.php?timezone=true&IP=";404END_PROGRAM"""405test_process(text)406##############407text = """408FUNCTION_BLOCK FILE_PATH_SPLIT409FOR b := 1 TO c DO410END_FOR;411END_FUNCTION_BLOCK412"""...

Full Screen

Full Screen

whatswrong.py

Source:whatswrong.py Github

copy

Full Screen

...17lisp_sexpr = True18def test():19 import os20 from libwwnlp.corpus_navigator import CorpusNavigator21 def test_process(corp_format, fname, min_sent=0, max_sent=2):22 print('Testing {0}'.format(corp_format), file=sys.stderr)23 nav = CorpusNavigator()24 nav.add_corpus(fname, corp_format, 'gold', min_sent, max_sent)25 nav.select_gold(os.path.basename(fname))26 for n, inst in enumerate(nav.iter_gold()):27 nav.canvas.set_nlp_instance(inst)28 nav.canvas.render_nlpgraphics('{0}_output{1}.svg'.format(corp_format, n))29 if conll2000:30 test_process('CoNLL2000', 'test_data/conll00.gold')31 if conll2002:32 test_process('CoNLL2002', 'test_data/conll02.gold')33 if conll2003:34 test_process('CoNLL2003', 'test_data/conll03.gold')35 if conll2004:36 test_process('CoNLL2004', 'test_data/conll04.gold')37 if conll2005:38 test_process('CoNLL2005', 'test_data/conll05.gold')39 if conll2006:40 test_process('CoNLL2006', 'test_data/conll06.gold')41 if conll2008:42 test_process('CoNLL2008', 'test_data/conll08.open')43 if conll2009:44 test_process('CoNLL2008', 'test_data/conll09.gold', max_sent=1)45 if malt:46 test_process('MaltTab', 'test_data/malt.gold')47 if giza:48 test_process('Giza Alingment Format', 'test_data/giza.gold')49 if gale:50 test_process('Gale Alingment Format', 'test_data/gale.gold', max_sent=1)51 if thebeast:52 test_process('The Beast Format', 'test_data/gale.gold', max_sent=1)53 if bionlp09:54 test_process('BioNLP2009 Shared Task Format', 'test_data/bionlp09', max_sent=1)55 if lisp_sexpr:56 test_process('Lisp S-expr Format', 'test_data/lispsexpr.gold', max_sent=1)57if __name__ == '__main__':58 if len(sys.argv) > 1 and sys.argv[1] == 'TEST':59 test()60 exit(0)61 else:62 from Qt5GUI.gui_main import main...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run green automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful