-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed travis failure due to indenation
Fixed travis failure due to indenation Signed-off-by: Praveen K Pandey <[email protected]>
- Loading branch information
1 parent
d9691f2
commit 20dbef1
Showing
1 changed file
with
23 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,29 +14,33 @@ | |
# Ayush Jain <[email protected]> | ||
# | ||
|
||
import os, re | ||
import os | ||
import re | ||
from avocado import Test | ||
from avocado.utils import process, genio, archive, build | ||
from avocado.utils.software_manager.manager import SoftwareManager | ||
from avocado.utils.partition import Partition | ||
|
||
|
||
class Fsx(Test): | ||
''' | ||
The Fsx test is a file system exerciser test | ||
:avocado: tags=fs | ||
''' | ||
def parse_results(self,results): | ||
pattern = re.compile(r"\b(passed|failed|broken|skipped|warnings)\s+(\d+)") | ||
|
||
def parse_results(self, results): | ||
pattern = re.compile( | ||
r"\b(passed|failed|broken|skipped|warnings)\s+(\d+)") | ||
matches = pattern.findall(results.stderr.decode("utf-8")) | ||
result_dict = dict(matches) | ||
for param,count in result_dict.items(): | ||
for param, count in result_dict.items(): | ||
self.log.info(f"{str(param)} : {str(count)}") | ||
if(int(result_dict["failed"]) > 0 or int(result_dict["broken"]) > 0): | ||
if (int(result_dict["failed"]) > 0 or int(result_dict["broken"]) > 0): | ||
self.fail('Fsx test failed') | ||
elif(int(result_dict["skipped"]) > 0): | ||
elif (int(result_dict["skipped"]) > 0): | ||
self.cancel(f'Fsx test {result_dict["skipped"]} skipped') | ||
elif(int(result_dict["warnings"]) > 0): | ||
elif (int(result_dict["warnings"]) > 0): | ||
self.log.warn(f'Fsx test {result_dict["warnings"]} warns') | ||
|
||
@staticmethod | ||
|
@@ -70,7 +74,8 @@ def setup_tmpfs_dir(self): | |
else: | ||
self.device = Partition( | ||
device=self.disk, mountpoint=self.dir) | ||
self.device.mount(mountpoint=self.dir, fstype="tmpfs", mnt_check=False) | ||
self.device.mount(mountpoint=self.dir, | ||
fstype="tmpfs", mnt_check=False) | ||
|
||
def setUp(self): | ||
''' | ||
|
@@ -93,7 +98,7 @@ def setUp(self): | |
else: | ||
self.output = self.params.get('output_file', default=None) | ||
if not self.output: | ||
self.output=os.path.join(self.workdir,"result") | ||
self.output = os.path.join(self.workdir, "result") | ||
|
||
if not os.path.exists(self.output): | ||
os.makedirs(self.output) | ||
|
@@ -107,7 +112,7 @@ def setUp(self): | |
"ltp-master%s" % match, locations=[url], expire='7d') | ||
else: | ||
self.cancel("Provided LTP Url is not valid") | ||
self.ltpdir_parent = os.path.join(self.workdir,'/ltp') | ||
self.ltpdir_parent = os.path.join(self.workdir, '/ltp') | ||
if not os.path.exists(self.ltpdir_parent): | ||
os.mkdir(self.ltpdir_parent) | ||
archive.extract(tarball, self.ltpdir_parent) | ||
|
@@ -116,8 +121,10 @@ def setUp(self): | |
build.make(self.ltp_dir, extra_args='autotools') | ||
process.system('./configure') | ||
|
||
self.test_file_max_size = self.params.get('test_file_max_size', default='1000000') | ||
self.single_op_max_size = self.params.get('single_op_max_size', default='1000000') | ||
self.test_file_max_size = self.params.get( | ||
'test_file_max_size', default='1000000') | ||
self.single_op_max_size = self.params.get( | ||
'single_op_max_size', default='1000000') | ||
self.total_ops = self.params.get('total_ops', default='1000') | ||
self.num_times = self.params.get('num_times', default='1') | ||
|
||
|
@@ -126,15 +133,15 @@ def test(self): | |
Run Fsx test for exercising file system | ||
''' | ||
|
||
fsx_dir=os.path.join(self.ltp_dir,"testcases/kernel/fs/fsx-linux") | ||
fsx_dir = os.path.join(self.ltp_dir, "testcases/kernel/fs/fsx-linux") | ||
os.chdir(fsx_dir) | ||
build.make(fsx_dir) | ||
|
||
cmd = "TMPDIR=%s ./fsx-linux -l %s -o %s -N %s -i %s -D" \ | ||
% (self.output, self.test_file_max_size, self.single_op_max_size, \ | ||
self.total_ops, self.num_times) | ||
% (self.output, self.test_file_max_size, self.single_op_max_size, | ||
self.total_ops, self.num_times) | ||
|
||
results = process.run(cmd,shell=True) | ||
results = process.run(cmd, shell=True) | ||
self.parse_results(results) | ||
|
||
def tearDown(self): | ||
|