-
Notifications
You must be signed in to change notification settings - Fork 508
/
Copy pathTESTS.py
executable file
·112 lines (79 loc) · 3.68 KB
/
TESTS.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!../env.py
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2019-2023, Intel Corporation
#
import futils
import testframework as t
from testframework import granularity as g
@t.require_build(['debug', 'release'])
class EX_LIBPMEM2(t.Test):
test_type = t.Medium
file_size = 1 * t.MiB
offset = str(97 * t.KiB)
length = str(65 * t.KiB)
class TEST0(EX_LIBPMEM2):
def run(self, ctx):
example_path = futils.get_example_path(ctx, 'pmem2', 'basic')
file_path = ctx.create_non_zero_file(self.file_size, 'testfile0')
ctx.exec(example_path, file_path)
class TEST1(EX_LIBPMEM2):
def run(self, ctx):
example_path = futils.get_example_path(ctx, 'pmem2', 'advanced')
file_path = ctx.create_non_zero_file(self.file_size, 'testfile0')
ctx.exec(example_path, file_path, self.offset, self.length)
class TEST2(EX_LIBPMEM2):
file_size = 16 * t.MiB
def run(self, ctx):
example_path = futils.get_example_path(ctx, 'pmem2', 'log')
file_path = ctx.create_holey_file(self.file_size, 'testfile0')
args = ['appendv', '4', 'PMDK ', 'is ', 'the best ', 'open source ',
'append', 'project in the world.', 'dump', 'rewind', 'dump',
'appendv', '2', 'End of ', 'file.', 'dump']
ctx.exec(example_path, file_path, *args, stdout_file='out2.log')
class TEST3(EX_LIBPMEM2):
def run(self, ctx):
example_path = futils.get_example_path(ctx, 'pmem2', 'redo')
file_path = ctx.create_holey_file(self.file_size, 'testfile0')
for x in range(1, 100):
ctx.exec(example_path, "add", file_path, x, x)
ctx.exec(example_path, "check", file_path)
ctx.exec(example_path, "print", file_path, stdout_file='out3.log')
class TEST4(EX_LIBPMEM2):
def run(self, ctx):
example_path = futils.get_example_path(ctx, 'pmem2',
'map_multiple_files')
args = []
for x in range(1, 10):
file_path = ctx.create_holey_file(self.file_size,
'testfile{}'.format(x))
args.append(file_path)
ctx.exec(example_path, *args, stdout_file='out4.log')
# XXX
# Manually disabled for pmemcheck for g.PAGE until ready fix for
# https://github.com/pmem/pmdk/issues/5641
# additionall test TEST501 has been added to cover non-pmemcheck configs.
@g.require_granularity(g.CACHELINE, g.BYTE) # to be removed when fix available
@t.require_valgrind_enabled('pmemcheck') # to be removed when fix available
class TEST5(EX_LIBPMEM2):
def run(self, ctx):
example_path = futils.get_example_path(ctx, 'pmem2', 'unsafe_shutdown')
file_path = ctx.create_holey_file(self.file_size, 'testfile0')
ctx.exec(example_path, "write", file_path, "foobar")
ctx.exec(example_path, "read", file_path, stdout_file='out5.log')
# XXX see TEST5 above
@t.require_valgrind_disabled('pmemcheck')
class TEST501(TEST5): # to be removed when fix available
pass
@t.windows_exclude
# This test case would require two VALGRIND_SET_CLEAN() calls
# to be added to the "src/examples/libpmem2/ringbuf/ringbuf.c"
# example (see https://github.com/pmem/pmdk/pull/5604)
# in order to pass under pmemcheck, but examples
# do not use valgrind macros on purpose (to avoid unnecessary
# complication), so this test case just should not be run under pmemcheck.
@t.require_valgrind_disabled('pmemcheck')
class TEST6(EX_LIBPMEM2):
def run(self, ctx):
example_path = futils.get_example_path(ctx, 'pmem2', 'ringbuf')
file_path = ctx.create_holey_file(self.file_size, 'testfile0')
ctx.exec(example_path, file_path, 10000, 4096, stdout_file='out6.log')