summaryrefslogtreecommitdiff
path: root/common/scripts/overlayfs.py
blob: 4ce5c9ab440a46a25630428c000877b6181aba9e (plain)
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
#!/usr/bin/env python
#
# Run overlay filesystem test from unionmount testsuite on Linaro ubuntu and
# OpenEmbedded.
#
# Copyright (C) 2012 - 2014, Linaro Limited.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
# Author: Chase Qi <chase.qi@linaro.org>
#
import os
import sys
import subprocess

TestSuitePath = sys.argv[1]
TermSlashList = ['0', '1']
TESTS = ['open-plain',
         'open-trunc',
         'open-creat',
         'open-creat-trunc',
         'open-creat-excl',
         'open-creat-excl-trunc',
         'noent-plain',
         'noent-trunc',
         'noent-creat',
         'noent-creat-trunc',
         'noent-creat-excl',
         'noent-creat-excl-trunc',
         'sym1-plain',
         'sym1-trunc',
         'sym1-creat',
         'sym1-creat-excl',
         'sym2-plain',
         'sym2-trunc',
         'sym2-creat',
         'sym2-creat-excl',
         'symx-plain',
         'symx-trunc',
         'symx-creat',
         'symx-creat-excl',
         'symx-creat-trunc',
         'truncate',
         'dir-open',
         'dir-weird-open',
         'dir-open-dir',
         'dir-weird-open-dir',
         'dir-sym1-open',
         'dir-sym1-weird-open',
         'dir-sym2-open',
         'dir-sym2-weird-open',
         'readlink',
         'mkdir',
         'rmdir',
         'hard-link',
         'hard-link-dir',
         'hard-link-sym',
         'unlink',
         'rename-file',
         'rename-empty-dir',
         'rename-new-dir',
         'rename-pop-dir',
         'rename-new-pop-dir',
         'rename-move-dir',
         'rename-mass',
         'rename-mass-2',
         'rename-mass-3',
         'rename-mass-4',
         'rename-mass-5',
         'rename-mass-dir',
         'rename-mass-sym',
         'impermissible']

if os.path.isfile('/usr/bin/python3'):
    PYTHON = 'python3'
else:
    PYTHON = 'python'
PythonVersion = subprocess.check_output([PYTHON, '--version'])
print 'Running tests with: ' + PythonVersion

for TEST in TESTS:
    for TermSlash in TermSlashList:
        if TermSlash == '1':
            SUFFIX = '-termslash'
        else:
            SUFFIX = ''

        TestCommand = [PYTHON, TestSuitePath + '/run', '--ov',
                       '--ts=' + TermSlash, TEST]
        print 'Running %s with command: %s' % (TEST, TestCommand)
        if subprocess.call(TestCommand) == 0:
            subprocess.call(['lava-test-case', TEST + SUFFIX,
                             '--result', 'pass'])
        else:
            subprocess.call(['lava-test-case', TEST + SUFFIX,
                             '--result', 'fail'])