Skip to content

Commit a3ae2ba

Browse files
committed
Add more error message for test
1 parent d4aa596 commit a3ae2ba

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/sonic-config-engine/tests/test_acl.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from unittest import TestCase
66

7-
class TestJ2Files(TestCase):
7+
class TestAcl(TestCase):
88
def setUp(self):
99
self.test_dir = os.path.dirname(os.path.realpath(__file__))
1010
self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfggen')
@@ -16,11 +16,23 @@ def setUp(self):
1616

1717
def run_script(self, argument):
1818
print 'CMD: sonic-cfggen ' + argument
19-
return subprocess.check_output(self.script_file + ' ' + argument, shell=True)
19+
output = ''
20+
try:
21+
output = subprocess.check_output(self.script_file + ' ' + argument, shell=True, stderr=subprocess.STDOUT)
22+
except subprocess.CalledProcessError, (p):
23+
print 'subprocess.CalledProcessError: cmd:%s returncode:%s' % (p.cmd, p.returncode)
24+
print output
25+
return output
2026

2127
def run_acl_script(self, argument):
2228
print 'CMD: translate_acl ' + argument
23-
return subprocess.check_output(self.acl_script_file + ' ' + argument, shell=True)
29+
output = ''
30+
try:
31+
output = subprocess.check_output(self.acl_script_file + ' ' + argument, shell=True, stderr=subprocess.STDOUT)
32+
except subprocess.CalledProcessError, (p):
33+
print 'subprocess.CalledProcessError: cmd:%s returncode:%s' % (p.cmd, p.returncode)
34+
print output
35+
return output
2436

2537
def test_translate_acl(self):
2638
argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -o ' + self.test_dir + ' ' + self.t0_acl
@@ -30,7 +42,7 @@ def test_translate_acl(self):
3042
output_file = os.path.join(self.test_dir, filename)
3143
assert filecmp.cmp(sample_output_file, output_file)
3244

33-
def test_translate_everflor(self):
45+
def test_translate_everflow(self):
3446
argument = '-m ' + self.t0_minigraph_everflow + ' -p ' + self.t0_port_config + ' -o ' + self.test_dir + ' ' + self.t0_acl
3547
self.run_acl_script(argument)
3648
for filename in ['rules_for_everflow.json','table_everflow.json']:

0 commit comments

Comments
 (0)