Skip to content

Commit 6ec7ab2

Browse files
committed
Python: Add test of Python 2 specific SystemCommandExecution
1 parent 984194d commit 6ec7ab2

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
| SystemCommandExecution.py:4:26:4:51 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
2+
| SystemCommandExecution.py:5:26:5:51 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
3+
| SystemCommandExecution.py:6:26:6:51 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
4+
| SystemCommandExecution.py:9:30:9:55 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
5+
| SystemCommandExecution.py:10:30:10:55 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
6+
| SystemCommandExecution.py:11:30:11:55 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
7+
| SystemCommandExecution.py:19:31:19:56 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
8+
| SystemCommandExecution.py:20:35:20:60 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
9+
| SystemCommandExecution.py:26:30:26:55 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
10+
| SystemCommandExecution.py:27:30:27:55 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
11+
| SystemCommandExecution.py:28:30:28:55 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
12+
| SystemCommandExecution.py:29:30:29:55 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
13+
| SystemCommandExecution.py:30:30:30:55 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
14+
| SystemCommandExecution.py:32:34:32:59 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
15+
| SystemCommandExecution.py:33:34:33:59 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
16+
| SystemCommandExecution.py:34:34:34:59 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
17+
| SystemCommandExecution.py:35:34:35:59 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
18+
| SystemCommandExecution.py:36:34:36:59 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import python
2+
import experimental.meta.ConceptsTest
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
########################################
2+
import os
3+
4+
os.popen2("cmd1; cmd2") # $getCommand="cmd1; cmd2"
5+
os.popen3("cmd1; cmd2") # $getCommand="cmd1; cmd2"
6+
os.popen4("cmd1; cmd2") # $getCommand="cmd1; cmd2"
7+
8+
9+
os.popen2(cmd="cmd1; cmd2") # $getCommand="cmd1; cmd2"
10+
os.popen3(cmd="cmd1; cmd2") # $getCommand="cmd1; cmd2"
11+
os.popen4(cmd="cmd1; cmd2") # $getCommand="cmd1; cmd2"
12+
13+
# os.popen does not support keyword arguments
14+
os.popen(cmd="cmd1; cmd2")
15+
16+
########################################
17+
import platform
18+
19+
platform.popen("cmd1; cmd2") # $getCommand="cmd1; cmd2"
20+
platform.popen(cmd="cmd1; cmd2") # $getCommand="cmd1; cmd2"
21+
22+
########################################
23+
# popen2 was deprecated in Python 2.6, but still available in Python 2.7
24+
import popen2
25+
26+
popen2.popen2("cmd1; cmd2") # $getCommand="cmd1; cmd2"
27+
popen2.popen3("cmd1; cmd2") # $getCommand="cmd1; cmd2"
28+
popen2.popen4("cmd1; cmd2") # $getCommand="cmd1; cmd2"
29+
popen2.Popen3("cmd1; cmd2") # $getCommand="cmd1; cmd2"
30+
popen2.Popen4("cmd1; cmd2") # $getCommand="cmd1; cmd2"
31+
32+
popen2.popen2(cmd="cmd1; cmd2") # $getCommand="cmd1; cmd2"
33+
popen2.popen3(cmd="cmd1; cmd2") # $getCommand="cmd1; cmd2"
34+
popen2.popen4(cmd="cmd1; cmd2") # $getCommand="cmd1; cmd2"
35+
popen2.Popen3(cmd="cmd1; cmd2") # $getCommand="cmd1; cmd2"
36+
popen2.Popen4(cmd="cmd1; cmd2") # $getCommand="cmd1; cmd2"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
semmle-extractor-options: --max-import-depth=1 --lang=2

0 commit comments

Comments
 (0)