Also run Python tests
This commit is contained in:
parent
787153a29a
commit
aa6b3b4bae
70
0001-test-py-add-require_free_space.patch
Normal file
70
0001-test-py-add-require_free_space.patch
Normal file
@ -0,0 +1,70 @@
|
||||
From 2bfc80d85248ed0014e396c2cab4b8ffb60e470e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marcin=20=C5=9Alusarz?= <marcin.slusarz@intel.com>
|
||||
Date: Tue, 18 Feb 2020 15:51:12 +0100
|
||||
Subject: [PATCH] test: (py) add require_free_space
|
||||
|
||||
---
|
||||
src/test/obj_defrag_advanced/TESTS.py | 4 ++++
|
||||
src/test/unittest/context.py | 11 ++++++++---
|
||||
2 files changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/test/obj_defrag_advanced/TESTS.py b/src/test/obj_defrag_advanced/TESTS.py
|
||||
index 8979af4a5..daf7d8ecc 100755
|
||||
--- a/src/test/obj_defrag_advanced/TESTS.py
|
||||
+++ b/src/test/obj_defrag_advanced/TESTS.py
|
||||
@@ -49,6 +49,8 @@ class ObjDefragAdvanced(t.BaseTest):
|
||||
min_root_size = 0
|
||||
|
||||
def run(self, ctx):
|
||||
+ ctx.require_free_space(self.pool_size)
|
||||
+
|
||||
path = ctx.create_holey_file(self.pool_size, 'testfile')
|
||||
dump1 = 'dump1.log'
|
||||
dump2 = 'dump2.log'
|
||||
@@ -98,6 +100,8 @@ class ObjDefragAdvancedMt(ObjDefragAdvanced):
|
||||
ncycles = 2
|
||||
|
||||
def run(self, ctx):
|
||||
+ ctx.require_free_space(self.pool_size)
|
||||
+
|
||||
path = ctx.create_holey_file(self.pool_size, 'testfile')
|
||||
|
||||
ctx.exec('obj_defrag_advanced',
|
||||
diff --git a/src/test/unittest/context.py b/src/test/unittest/context.py
|
||||
index 00a35fba3..2b326ebce 100644
|
||||
--- a/src/test/unittest/context.py
|
||||
+++ b/src/test/unittest/context.py
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
-# Copyright 2019, Intel Corporation
|
||||
+# Copyright 2019-2020, Intel Corporation
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
@@ -136,9 +136,9 @@ class ContextBase:
|
||||
return int(proc.stdout)
|
||||
futils.fail('Could not get size of the file, it is inaccessible or does not exist')
|
||||
|
||||
- def get_free_space(self):
|
||||
+ def get_free_space(self, dir="."):
|
||||
"""Returns free space for current file system"""
|
||||
- _, _, free = shutil.disk_usage(".")
|
||||
+ _, _, free = shutil.disk_usage(dir)
|
||||
return free
|
||||
|
||||
|
||||
@@ -187,6 +187,11 @@ class Context(ContextBase):
|
||||
os.chmod(filepath, mode)
|
||||
return filepath
|
||||
|
||||
+ def require_free_space(self, space):
|
||||
+ if self.get_free_space(self.testdir) < space:
|
||||
+ futils.skip('Not enough free space (' + str(space / 1024 / 1024) +
|
||||
+ ' MiB required)')
|
||||
+
|
||||
def mkdirs(self, path, mode=None):
|
||||
"""
|
||||
Creates directory along with all parent directories required. In the
|
||||
--
|
||||
2.17.2
|
||||
|
||||
32
nvml.spec
32
nvml.spec
@ -2,7 +2,6 @@
|
||||
# rpmbuild options:
|
||||
# --with | --without fabric
|
||||
# --with | --without ndctl
|
||||
# --define _testconfig <path to custom testconfig.sh>
|
||||
|
||||
# do not terminate build if files in the $RPM_BUILD_ROOT
|
||||
# directory are not found in %%files (without fabric case)
|
||||
@ -39,6 +38,7 @@ License: BSD
|
||||
URL: http://pmem.io/pmdk
|
||||
|
||||
Source0: https://github.com/pmem/pmdk/releases/download/%{upstreamversion}/pmdk-%{upstreamversion}.tar.gz
|
||||
Patch0: 0001-test-py-add-require_free_space.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: make
|
||||
@ -47,6 +47,7 @@ BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: man
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: python3
|
||||
|
||||
%if %{with ndctl}
|
||||
BuildRequires: ndctl-devel >= %{min_ndctl_ver}
|
||||
@ -526,6 +527,7 @@ provided in the command line options to check whether files are in a consistent
|
||||
|
||||
%prep
|
||||
%setup -q -n pmdk-%{upstreamversion}
|
||||
%patch0 -p1
|
||||
|
||||
|
||||
%build
|
||||
@ -556,13 +558,27 @@ cp utils/pmdk.magic %{buildroot}%{_datadir}/pmdk/
|
||||
%if 0%{?_skip_check} == 1
|
||||
echo "Check skipped"
|
||||
%else
|
||||
%if %{defined _testconfig}
|
||||
cp %{_testconfig} src/test/testconfig.sh
|
||||
%else
|
||||
echo "PMEM_FS_DIR=/tmp" > src/test/testconfig.sh
|
||||
echo "PMEM_FS_DIR_FORCE_PMEM=1" >> src/test/testconfig.sh
|
||||
echo 'TEST_BUILD="debug nondebug"' >> src/test/testconfig.sh
|
||||
%endif
|
||||
echo "PMEM_FS_DIR=/tmp" > src/test/testconfig.sh
|
||||
echo "PMEM_FS_DIR_FORCE_PMEM=1" >> src/test/testconfig.sh
|
||||
echo 'TEST_BUILD="debug nondebug"' >> src/test/testconfig.sh
|
||||
echo "TM=1" >> src/test/testconfig.sh
|
||||
|
||||
echo "config = {" > src/test/testconfig.py
|
||||
echo " 'pmem_fs_dir': '/tmp'," >> src/test/testconfig.py
|
||||
echo " 'fs_dir_force_pmem': 1," >> src/test/testconfig.py
|
||||
echo " 'build': ['debug', 'release']," >> src/test/testconfig.py
|
||||
echo " 'tm': 1," >> src/test/testconfig.py
|
||||
echo " 'test_type': 'check'," >> src/test/testconfig.py
|
||||
echo " 'fs': 'all'," >> src/test/testconfig.py
|
||||
echo " 'unittest_log_level': 1," >> src/test/testconfig.py
|
||||
echo " 'keep_going': False," >> src/test/testconfig.py
|
||||
echo " 'timeout': '3m'," >> src/test/testconfig.py
|
||||
echo " 'dump_lines': 30," >> src/test/testconfig.py
|
||||
echo " 'force_enable': None," >> src/test/testconfig.py
|
||||
echo " 'device_dax_path': []," >> src/test/testconfig.py
|
||||
echo "}" >> src/test/testconfig.py
|
||||
|
||||
make pycheck
|
||||
make check
|
||||
%endif
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user