summaryrefslogtreecommitdiffstats
path: root/unit-tests
diff options
context:
space:
mode:
authorJoe Thornber <thornber@redhat.com>2010-07-20 15:18:57 +0000
committerJoe Thornber <thornber@redhat.com>2010-07-20 15:18:57 +0000
commit80b99da822c69cc9d5c3ac167c5b587fe954b5de (patch)
treea31ca47445d487fe7ac053e8c3e7e25fcbed3c6e /unit-tests
parent1033d120404c0e41ced5f36361e412ac03a3461f (diff)
downloadlvm2-80b99da822c69cc9d5c3ac167c5b587fe954b5de.tar.gz
lvm2-80b99da822c69cc9d5c3ac167c5b587fe954b5de.tar.xz
lvm2-80b99da822c69cc9d5c3ac167c5b587fe954b5de.zip
Move tests from old-tests/regex to unit-tests/regex. unit-tests will
contain tests that currently work.
Diffstat (limited to 'unit-tests')
-rw-r--r--unit-tests/regex/Makefile.in37
-rw-r--r--unit-tests/regex/dev_patterns2
-rw-r--r--unit-tests/regex/devices.list880
-rw-r--r--unit-tests/regex/matcher_t.c145
-rw-r--r--unit-tests/regex/parse_t.c118
5 files changed, 1182 insertions, 0 deletions
diff --git a/unit-tests/regex/Makefile.in b/unit-tests/regex/Makefile.in
new file mode 100644
index 00000000..b15b2316
--- /dev/null
+++ b/unit-tests/regex/Makefile.in
@@ -0,0 +1,37 @@
+#
+# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+# Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
+#
+# This file is part of LVM2.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
+
+SOURCES=\
+ parse_t.c \
+ matcher_t.c
+
+TARGETS=\
+ parse_t \
+ matcher_t
+
+include $(top_builddir)/make.tmpl
+
+INCLUDES += -I$(top_srcdir)/libdm
+DM_DEPS = $(top_builddir)/libdm/libdevmapper.so
+DM_LIBS = -ldevmapper $(LIBS)
+
+parse_t: parse_t.o $(DM_DEPS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ parse_t.o $(DM_LIBS)
+
+matcher_t: matcher_t.o $(DM_DEPS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ matcher_t.o $(DM_LIBS)
diff --git a/unit-tests/regex/dev_patterns b/unit-tests/regex/dev_patterns
new file mode 100644
index 00000000..34459ba6
--- /dev/null
+++ b/unit-tests/regex/dev_patterns
@@ -0,0 +1,2 @@
+"loop/[0-9]+"
+"hd[a-d][0-5]+"
diff --git a/unit-tests/regex/devices.list b/unit-tests/regex/devices.list
new file mode 100644
index 00000000..91af305e
--- /dev/null
+++ b/unit-tests/regex/devices.list
@@ -0,0 +1,880 @@
+/dev
+/dev/.devfsd
+/dev/cpu
+/dev/cpu/mtrr
+/dev/netlink
+/dev/netlink/route
+/dev/netlink/skip
+/dev/netlink/USERSOCK
+/dev/netlink/fwmonitor
+/dev/netlink/ARPD
+/dev/netlink/ROUTE6
+/dev/netlink/IP6_FW
+/dev/netlink/tap0
+/dev/netlink/tap1
+/dev/netlink/tap2
+/dev/netlink/tap3
+/dev/netlink/tap4
+/dev/netlink/tap5
+/dev/netlink/tap6
+/dev/netlink/tap7
+/dev/netlink/tap8
+/dev/netlink/tap9
+/dev/netlink/tap10
+/dev/netlink/tap11
+/dev/netlink/tap12
+/dev/netlink/tap13
+/dev/netlink/tap14
+/dev/netlink/tap15
+/dev/shm
+/dev/mem
+/dev/kmem
+/dev/null
+/dev/port
+/dev/zero
+/dev/full
+/dev/random
+/dev/urandom
+/dev/tty
+/dev/console
+/dev/vc
+/dev/vc/1
+/dev/vc/2
+/dev/vc/3
+/dev/vc/4
+/dev/vc/5
+/dev/vc/6
+/dev/vc/7
+/dev/vc/8
+/dev/vc/9
+/dev/vc/10
+/dev/vc/11
+/dev/vc/12
+/dev/vc/13
+/dev/vc/14
+/dev/vc/15
+/dev/vc/16
+/dev/vc/17
+/dev/vc/18
+/dev/vc/19
+/dev/vc/20
+/dev/vc/21
+/dev/vc/22
+/dev/vc/23
+/dev/vc/24
+/dev/vc/25
+/dev/vc/26
+/dev/vc/27
+/dev/vc/28
+/dev/vc/29
+/dev/vc/30
+/dev/vc/31
+/dev/vc/32
+/dev/vc/33
+/dev/vc/34
+/dev/vc/35
+/dev/vc/36
+/dev/vc/37
+/dev/vc/38
+/dev/vc/39
+/dev/vc/40
+/dev/vc/41
+/dev/vc/42
+/dev/vc/43
+/dev/vc/44
+/dev/vc/45
+/dev/vc/46
+/dev/vc/47
+/dev/vc/48
+/dev/vc/49
+/dev/vc/50
+/dev/vc/51
+/dev/vc/52
+/dev/vc/53
+/dev/vc/54
+/dev/vc/55
+/dev/vc/56
+/dev/vc/57
+/dev/vc/58
+/dev/vc/59
+/dev/vc/60
+/dev/vc/61
+/dev/vc/62
+/dev/vc/63
+/dev/vc/0
+/dev/ptmx
+/dev/misc
+/dev/misc/psaux
+/dev/pty
+/dev/pty/m0
+/dev/pty/m1
+/dev/pty/m2
+/dev/pty/m3
+/dev/pty/m4
+/dev/pty/m5
+/dev/pty/m6
+/dev/pty/m7
+/dev/pty/m8
+/dev/pty/m9
+/dev/pty/m10
+/dev/pty/m11
+/dev/pty/m12
+/dev/pty/m13
+/dev/pty/m14
+/dev/pty/m15
+/dev/pty/m16
+/dev/pty/m17
+/dev/pty/m18
+/dev/pty/m19
+/dev/pty/m20
+/dev/pty/m21
+/dev/pty/m22
+/dev/pty/m23
+/dev/pty/m24
+/dev/pty/m25
+/dev/pty/m26
+/dev/pty/m27
+/dev/pty/m28
+/dev/pty/m29
+/dev/pty/m30
+/dev/pty/m31
+/dev/pty/m32
+/dev/pty/m33
+/dev/pty/m34
+/dev/pty/m35
+/dev/pty/m36
+/dev/pty/m37
+/dev/pty/m38
+/dev/pty/m39
+/dev/pty/m40
+/dev/pty/m41
+/dev/pty/m42
+/dev/pty/m43
+/dev/pty/m44
+/dev/pty/m45
+/dev/pty/m46
+/dev/pty/m47
+/dev/pty/m48
+/dev/pty/m49
+/dev/pty/m50
+/dev/pty/m51
+/dev/pty/m52
+/dev/pty/m53
+/dev/pty/m54
+/dev/pty/m55
+/dev/pty/m56
+/dev/pty/m57
+/dev/pty/m58
+/dev/pty/m59
+/dev/pty/m60
+/dev/pty/m61
+/dev/pty/m62
+/dev/pty/m63
+/dev/pty/m64
+/dev/pty/m65
+/dev/pty/m66
+/dev/pty/m67
+/dev/pty/m68
+/dev/pty/m69
+/dev/pty/m70
+/dev/pty/m71
+/dev/pty/m72
+/dev/pty/m73
+/dev/pty/m74
+/dev/pty/m75
+/dev/pty/m76
+/dev/pty/m77
+/dev/pty/m78
+/dev/pty/m79
+/dev/pty/m80
+/dev/pty/m81
+/dev/pty/m82
+/dev/pty/m83
+/dev/pty/m84
+/dev/pty/m85
+/dev/pty/m86
+/dev/pty/m87
+/dev/pty/m88
+/dev/pty/m89
+/dev/pty/m90
+/dev/pty/m91
+/dev/pty/m92
+/dev/pty/m93
+/dev/pty/m94
+/dev/pty/m95
+/dev/pty/m96
+/dev/pty/m97
+/dev/pty/m98
+/dev/pty/m99
+/dev/pty/m100
+/dev/pty/m101
+/dev/pty/m102
+/dev/pty/m103
+/dev/pty/m104
+/dev/pty/m105
+/dev/pty/m106
+/dev/pty/m107
+/dev/pty/m108
+/dev/pty/m109
+/dev/pty/m110
+/dev/pty/m111
+/dev/pty/m112
+/dev/pty/m113
+/dev/pty/m114
+/dev/pty/m115
+/dev/pty/m116
+/dev/pty/m117
+/dev/pty/m118
+/dev/pty/m119
+/dev/pty/m120
+/dev/pty/m121
+/dev/pty/m122
+/dev/pty/m123
+/dev/pty/m124
+/dev/pty/m125
+/dev/pty/m126
+/dev/pty/m127
+/dev/pty/m128
+/dev/pty/m129
+/dev/pty/m130
+/dev/pty/m131
+/dev/pty/m132
+/dev/pty/m133
+/dev/pty/m134
+/dev/pty/m135
+/dev/pty/m136
+/dev/pty/m137
+/dev/pty/m138
+/dev/pty/m139
+/dev/pty/m140
+/dev/pty/m141
+/dev/pty/m142
+/dev/pty/m143
+/dev/pty/m144
+/dev/pty/m145
+/dev/pty/m146
+/dev/pty/m147
+/dev/pty/m148
+/dev/pty/m149
+/dev/pty/m150
+/dev/pty/m151
+/dev/pty/m152
+/dev/pty/m153
+/dev/pty/m154
+/dev/pty/m155
+/dev/pty/m156
+/dev/pty/m157
+/dev/pty/m158
+/dev/pty/m159
+/dev/pty/m160
+/dev/pty/m161
+/dev/pty/m162
+/dev/pty/m163
+/dev/pty/m164
+/dev/pty/m165
+/dev/pty/m166
+/dev/pty/m167
+/dev/pty/m168
+/dev/pty/m169
+/dev/pty/m170
+/dev/pty/m171
+/dev/pty/m172
+/dev/pty/m173
+/dev/pty/m174
+/dev/pty/m175
+/dev/pty/m176
+/dev/pty/m177
+/dev/pty/m178
+/dev/pty/m179
+/dev/pty/m180
+/dev/pty/m181
+/dev/pty/m182
+/dev/pty/m183
+/dev/pty/m184
+/dev/pty/m185
+/dev/pty/m186
+/dev/pty/m187
+/dev/pty/m188
+/dev/pty/m189
+/dev/pty/m190
+/dev/pty/m191
+/dev/pty/m192
+/dev/pty/m193
+/dev/pty/m194
+/dev/pty/m195
+/dev/pty/m196
+/dev/pty/m197
+/dev/pty/m198
+/dev/pty/m199
+/dev/pty/m200
+/dev/pty/m201
+/dev/pty/m202
+/dev/pty/m203
+/dev/pty/m204
+/dev/pty/m205
+/dev/pty/m206
+/dev/pty/m207
+/dev/pty/m208
+/dev/pty/m209
+/dev/pty/m210
+/dev/pty/m211
+/dev/pty/m212
+/dev/pty/m213
+/dev/pty/m214
+/dev/pty/m215
+/dev/pty/m216
+/dev/pty/m217
+/dev/pty/m218
+/dev/pty/m219
+/dev/pty/m220
+/dev/pty/m221
+/dev/pty/m222
+/dev/pty/m223
+/dev/pty/m224
+/dev/pty/m225
+/dev/pty/m226
+/dev/pty/m227
+/dev/pty/m228
+/dev/pty/m229
+/dev/pty/m230
+/dev/pty/m231
+/dev/pty/m232
+/dev/pty/m233
+/dev/pty/m234
+/dev/pty/m235
+/dev/pty/m236
+/dev/pty/m237
+/dev/pty/m238
+/dev/pty/m239
+/dev/pty/m240
+/dev/pty/m241
+/dev/pty/m242
+/dev/pty/m243
+/dev/pty/m244
+/dev/pty/m245
+/dev/pty/m246
+/dev/pty/m247
+/dev/pty/m248
+/dev/pty/m249
+/dev/pty/m250
+/dev/pty/m251
+/dev/pty/m252
+/dev/pty/m253
+/dev/pty/m254
+/dev/pty/m255
+/dev/pts
+/dev/pts/0
+/dev/pts/1
+/dev/pts/2
+/dev/pts/3
+/dev/pts/4
+/dev/pts/5
+/dev/pts/6
+/dev/pts/7
+/dev/vcc
+/dev/vcc/0
+/dev/vcc/a
+/dev/vcc/1
+/dev/vcc/a1
+/dev/vcc/2
+/dev/vcc/a2
+/dev/vcc/3
+/dev/vcc/a3
+/dev/vcc/5
+/dev/vcc/a5
+/dev/vcc/4
+/dev/vcc/a4
+/dev/vcc/6
+/dev/vcc/a6
+/dev/vcc/7
+/dev/vcc/a7
+/dev/tts
+/dev/tts/0
+/dev/cua
+/dev/cua/0
+/dev/ide
+/dev/ide/host0
+/dev/ide/host0/bus0
+/dev/ide/host0/bus0/target0
+/dev/ide/host0/bus0/target0/lun0
+/dev/ide/host0/bus0/target0/lun0/disc
+/dev/ide/host0/bus0/target0/lun0/part1
+/dev/ide/host0/bus0/target0/lun0/part2
+/dev/ide/host0/bus0/target0/lun0/part3
+/dev/ide/host0/bus0/target0/lun0/part4
+/dev/ide/host0/bus0/target0/lun0/part5
+/dev/ide/host0/bus0/target0/lun0/part6
+/dev/ide/host0/bus0/target0/lun0/part7
+/dev/ide/host0/bus0/target0/lun0/part8
+/dev/ide/host0/bus0/target1
+/dev/ide/host0/bus0/target1/lun0
+/dev/ide/host0/bus0/target1/lun0/disc
+/dev/ide/host0/bus0/target1/lun0/part1
+/dev/ide/host0/bus1
+/dev/ide/host0/bus1/target0
+/dev/ide/host0/bus1/target0/lun0
+/dev/ide/host0/bus1/target0/lun0/disc
+/dev/ide/host0/bus1/target0/lun0/part1
+/dev/ide/host0/bus1/target1
+/dev/ide/host0/bus1/target1/lun0
+/dev/discs
+/dev/discs/disc0
+/dev/discs/disc1
+/dev/discs/disc2
+/dev/floppy
+/dev/floppy/0u1440
+/dev/floppy/0u1680
+/dev/floppy/0u1722
+/dev/floppy/0u1743
+/dev/floppy/0u1760
+/dev/floppy/0u1920
+/dev/floppy/0u1840
+/dev/floppy/0u1600
+/dev/floppy/0u360
+/dev/floppy/0u720
+/dev/floppy/0u820
+/dev/floppy/0u830
+/dev/floppy/0u1040
+/dev/floppy/0u1120
+/dev/floppy/0u800
+/dev/floppy/0
+/dev/loop
+/dev/loop/0
+/dev/loop/1
+/dev/loop/2
+/dev/loop/3
+/dev/loop/4
+/dev/loop/5
+/dev/loop/6
+/dev/loop/7
+/dev/cdroms
+/dev/sound
+/dev/sound/dsp
+/dev/sound/dsp1
+/dev/sound/mixer
+/dev/sound/midi
+/dev/usb
+/dev/root
+/dev/initctl
+/dev/xconsole
+/dev/fd
+/dev/stdin
+/dev/stdout
+/dev/stderr
+/dev/route
+/dev/skip
+/dev/USERSOCK
+/dev/fwmonitor
+/dev/ARPD
+/dev/ROUTE6
+/dev/IP6_FW
+/dev/tap0
+/dev/tap1
+/dev/tap2
+/dev/tap3
+/dev/tap4
+/dev/tap5
+/dev/tap6
+/dev/tap7
+/dev/tap8
+/dev/tap9
+/dev/tap10
+/dev/tap11
+/dev/tap12
+/dev/tap13
+/dev/tap14
+/dev/tap15
+/dev/tty1
+/dev/tty2
+/dev/tty3
+/dev/tty4
+/dev/tty5
+/dev/tty6
+/dev/tty7
+/dev/tty8
+/dev/tty9
+/dev/tty10
+/dev/tty11
+/dev/tty12
+/dev/tty13
+/dev/tty14
+/dev/tty15
+/dev/tty16
+/dev/tty17
+/dev/tty18
+/dev/tty19
+/dev/tty20
+/dev/tty21
+/dev/tty22
+/dev/tty23
+/dev/tty24
+/dev/tty25
+/dev/tty26
+/dev/tty27
+/dev/tty28
+/dev/tty29
+/dev/tty30
+/dev/tty31
+/dev/tty32
+/dev/tty33
+/dev/tty34
+/dev/tty35
+/dev/tty36
+/dev/tty37
+/dev/tty38
+/dev/tty39
+/dev/tty40
+/dev/tty41
+/dev/tty42
+/dev/tty43
+/dev/tty44
+/dev/tty45
+/dev/tty46
+/dev/tty47
+/dev/tty48
+/dev/tty49
+/dev/tty50
+/dev/tty51
+/dev/tty52
+/dev/tty53
+/dev/tty54
+/dev/tty55
+/dev/tty56
+/dev/tty57
+/dev/tty58
+/dev/tty59
+/dev/tty60
+/dev/tty61
+/dev/tty62
+/dev/tty63
+/dev/tty0
+/dev/psaux
+/dev/ptyp0
+/dev/ptyp1
+/dev/ptyp2
+/dev/ptyp3
+/dev/ptyp4
+/dev/ptyp5
+/dev/ptyp6
+/dev/ptyp7
+/dev/ptyp8
+/dev/ptyp9
+/dev/ptypa
+/dev/ptypb
+/dev/ptypc
+/dev/ptypd
+/dev/ptype
+/dev/ptypf
+/dev/ptyq0
+/dev/ptyq1
+/dev/ptyq2
+/dev/ptyq3
+/dev/ptyq4
+/dev/ptyq5
+/dev/ptyq6
+/dev/ptyq7
+/dev/ptyq8
+/dev/ptyq9
+/dev/ptyqa
+/dev/ptyqb
+/dev/ptyqc
+/dev/ptyqd
+/dev/ptyqe
+/dev/ptyqf
+/dev/ptyr0
+/dev/ptyr1
+/dev/ptyr2
+/dev/ptyr3
+/dev/ptyr4
+/dev/ptyr5
+/dev/ptyr6
+/dev/ptyr7
+/dev/ptyr8
+/dev/ptyr9
+/dev/ptyra
+/dev/ptyrb
+/dev/ptyrc
+/dev/ptyrd
+/dev/ptyre
+/dev/ptyrf
+/dev/ptys0
+/dev/ptys1
+/dev/ptys2
+/dev/ptys3
+/dev/ptys4
+/dev/ptys5
+/dev/ptys6
+/dev/ptys7
+/dev/ptys8
+/dev/ptys9
+/dev/ptysa
+/dev/ptysb
+/dev/ptysc
+/dev/ptysd
+/dev/ptyse
+/dev/ptysf
+/dev/ptyt0
+/dev/ptyt1
+/dev/ptyt2
+/dev/ptyt3
+/dev/ptyt4
+/dev/ptyt5
+/dev/ptyt6
+/dev/ptyt7
+/dev/ptyt8
+/dev/ptyt9
+/dev/ptyta
+/dev/ptytb
+/dev/ptytc
+/dev/ptytd
+/dev/ptyte
+/dev/ptytf
+/dev/ptyu0
+/dev/ptyu1
+/dev/ptyu2
+/dev/ptyu3
+/dev/ptyu4
+/dev/ptyu5
+/dev/ptyu6
+/dev/ptyu7
+/dev/ptyu8
+/dev/ptyu9
+/dev/ptyua
+/dev/ptyub
+/dev/ptyuc
+/dev/ptyud
+/dev/ptyue
+/dev/ptyuf
+/dev/ptyv0
+/dev/ptyv1
+/dev/ptyv2
+/dev/ptyv3
+/dev/ptyv4
+/dev/ptyv5
+/dev/ptyv6
+/dev/ptyv7
+/dev/ptyv8
+/dev/ptyv9
+/dev/ptyva
+/dev/ptyvb
+/dev/ptyvc
+/dev/ptyvd
+/dev/ptyve
+/dev/ptyvf
+/dev/ptyw0
+/dev/ptyw1
+/dev/ptyw2
+/dev/ptyw3
+/dev/ptyw4
+/dev/ptyw5
+/dev/ptyw6
+/dev/ptyw7
+/dev/ptyw8
+/dev/ptyw9
+/dev/ptywa
+/dev/ptywb
+/dev/ptywc
+/dev/ptywd
+/dev/ptywe
+/dev/ptywf
+/dev/ptyx0
+/dev/ptyx1
+/dev/ptyx2
+/dev/ptyx3
+/dev/ptyx4
+/dev/ptyx5
+/dev/ptyx6
+/dev/ptyx7
+/dev/ptyx8
+/dev/ptyx9
+/dev/ptyxa
+/dev/ptyxb
+/dev/ptyxc
+/dev/ptyxd
+/dev/ptyxe
+/dev/ptyxf
+/dev/ptyy0
+/dev/ptyy1
+/dev/ptyy2
+/dev/ptyy3
+/dev/ptyy4
+/dev/ptyy5
+/dev/ptyy6
+/dev/ptyy7
+/dev/ptyy8
+/dev/ptyy9
+/dev/ptyya
+/dev/ptyyb
+/dev/ptyyc
+/dev/ptyyd
+/dev/ptyye
+/dev/ptyyf
+/dev/ptyz0
+/dev/ptyz1
+/dev/ptyz2
+/dev/ptyz3
+/dev/ptyz4
+/dev/ptyz5
+/dev/ptyz6
+/dev/ptyz7
+/dev/ptyz8
+/dev/ptyz9
+/dev/ptyza
+/dev/ptyzb
+/dev/ptyzc
+/dev/ptyzd
+/dev/ptyze
+/dev/ptyzf
+/dev/ptya0
+/dev/ptya1
+/dev/ptya2
+/dev/ptya3
+/dev/ptya4
+/dev/ptya5
+/dev/ptya6
+/dev/ptya7
+/dev/ptya8
+/dev/ptya9
+/dev/ptyaa
+/dev/ptyab
+/dev/ptyac
+/dev/ptyad
+/dev/ptyae
+/dev/ptyaf
+/dev/ptyb0
+/dev/ptyb1
+/dev/ptyb2
+/dev/ptyb3
+/dev/ptyb4
+/dev/ptyb5
+/dev/ptyb6
+/dev/ptyb7
+/dev/ptyb8
+/dev/ptyb9
+/dev/ptyba
+/dev/ptybb
+/dev/ptybc
+/dev/ptybd
+/dev/ptybe
+/dev/ptybf
+/dev/ptyc0
+/dev/ptyc1
+/dev/ptyc2
+/dev/ptyc3
+/dev/ptyc4
+/dev/ptyc5
+/dev/ptyc6
+/dev/ptyc7
+/dev/ptyc8
+/dev/ptyc9
+/dev/ptyca
+/dev/ptycb
+/dev/ptycc
+/dev/ptycd
+/dev/ptyce
+/dev/ptycf
+/dev/ptyd0
+/dev/ptyd1
+/dev/ptyd2
+/dev/ptyd3
+/dev/ptyd4
+/dev/ptyd5
+/dev/ptyd6
+/dev/ptyd7
+/dev/ptyd8
+/dev/ptyd9
+/dev/ptyda
+/dev/ptydb
+/dev/ptydc
+/dev/ptydd
+/dev/ptyde
+/dev/ptydf
+/dev/ptye0
+/dev/ptye1
+/dev/ptye2
+/dev/ptye3
+/dev/ptye4
+/dev/ptye5
+/dev/ptye6
+/dev/ptye7
+/dev/ptye8
+/dev/ptye9
+/dev/ptyea
+/dev/ptyeb
+/dev/ptyec
+/dev/ptyed
+/dev/ptyee
+/dev/ptyef
+/dev/vcs
+/dev/vcsa
+/dev/vcs1
+/dev/vcsa1
+/dev/ttyS0
+/dev/cua0
+/dev/hda
+/dev/hda1
+/dev/hda2
+/dev/hda3
+/dev/hda4
+/dev/hda5
+/dev/hda6
+/dev/hda7
+/dev/hda8
+/dev/hdb
+/dev/hdb1
+/dev/hdc
+/dev/hdc1
+/dev/fd0u1440
+/dev/fd0u1680
+/dev/fd0u1722
+/dev/fd0u1743
+/dev/fd0u1760
+/dev/fd0u1920
+/dev/fd0u1840
+/dev/fd0u1600
+/dev/fd0u360
+/dev/fd0u720
+/dev/fd0u820
+/dev/fd0u830
+/dev/fd0u1040
+/dev/fd0u1120
+/dev/fd0u800
+/dev/fd0
+/dev/loop0
+/dev/loop1
+/dev/loop2
+/dev/loop3
+/dev/loop4
+/dev/loop5
+/dev/loop6
+/dev/loop7
+/dev/dsp
+/dev/dsp1
+/dev/mixer
+/dev/midi
+/dev/lvm
+/dev/vg0
+/dev/vg0/group
+/dev/vg0/packages
+/dev/vg0/photos
+/dev/vg0/music
+/dev/log
+/dev/MAKEDEV
+/dev/printer
+/dev/vcs2
+/dev/vcsa2
+/dev/vcs3
+/dev/vcsa3
+/dev/vcs5
+/dev/vcsa5
+/dev/vcs4
+/dev/vcsa4
+/dev/vcs6
+/dev/vcsa6
+/dev/nvidia0
+/dev/nvidia1
+/dev/nvidia2
+/dev/nvidia3
+/dev/nvidiactl
+/dev/vcs7
+/dev/vcsa7
diff --git a/unit-tests/regex/matcher_t.c b/unit-tests/regex/matcher_t.c
new file mode 100644
index 00000000..1eb1b3c4
--- /dev/null
+++ b/unit-tests/regex/matcher_t.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "libdevmapper.h"
+#include "log.h"
+
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+
+static int _read_spec(const char *file, char ***regex, int *nregex)
+{
+ char buffer[1024], *start, *ptr;
+ FILE *fp = fopen(file, "r");
+ int asize = 100;
+ char **rx = dm_malloc(sizeof(*rx) * asize);
+ int nr = 0;
+
+ if (!fp)
+ return 0;
+
+ while (fgets(buffer, sizeof(buffer),fp)) {
+
+ /* trim leading whitespace */
+ for (ptr = buffer; *ptr && isspace((int) *ptr); ptr++);
+
+ if (!*ptr || *ptr == '#')
+ continue;
+
+ if (*ptr == '\"') {
+ ptr++;
+ start = ptr;
+ while (*ptr && *ptr != '\"') {
+ if (*ptr == '\\')
+ ptr++;
+ ptr++;
+ }
+
+ if (!*ptr) {
+ fprintf(stderr, "Formatting error : "
+ "No terminating quote\n");
+ return 0;
+ }
+
+ rx[nr] = dm_malloc((ptr - start) + 1);
+ strncpy(rx[nr], start, ptr - start);
+ rx[nr][ptr - start] = '\0';
+ nr++;
+ } else {
+ fprintf(stderr, "%s", ptr);
+ fprintf(stderr, "Formatting error : \"<regex>\" "
+ "<token_name>\n");
+ return 0;
+ }
+ }
+
+ *regex = rx;
+ *nregex = nr;
+ return 1;
+}
+
+static void _free_regex(char **regex, int nregex)
+{
+ int i;
+ for (i = 0; i < nregex; i++)
+ dm_free(regex[i]);
+
+ dm_free(regex);
+}
+
+static void _scan_input(struct dm_regex *m, char **regex)
+{
+ char buffer[256], *ptr;
+ int r;
+
+ while (fgets(buffer, sizeof(buffer), stdin)) {
+ if ((ptr = strchr(buffer, '\n')))
+ *ptr = '\0';
+
+ r = dm_regex_match(m, buffer);
+
+ if (r >= 0)
+ printf("%s : %s\n", buffer, regex[r]);
+ }
+}
+
+int main(int argc, char **argv)
+{
+ struct dm_pool *mem;
+ struct dm_regex *scanner;
+ char **regex;
+ int nregex;
+ int ret = 0;
+
+ if (argc < 2) {
+ fprintf(stderr, "Usage : %s <pattern_file>\n", argv[0]);
+ exit(1);
+ }
+
+ dm_log_init_verbose(_LOG_DEBUG);
+
+ if (!(mem = dm_pool_create("match_regex", 10 * 1024))) {
+ fprintf(stderr, "Couldn't create pool\n");
+ ret = 2;
+ goto err;
+ }
+
+ if (!_read_spec(argv[1], &regex, &nregex)) {
+ fprintf(stderr, "Couldn't read the lex specification\n");
+ ret = 3;
+ goto err;
+ }
+
+ if (!(scanner = dm_regex_create(mem, (const char **)regex, nregex))) {
+ fprintf(stderr, "Couldn't build the lexer\n");
+ ret = 4;
+ goto err;
+ }
+
+ _scan_input(scanner, regex);
+ _free_regex(regex, nregex);
+
+ err:
+ dm_pool_destroy(mem);
+
+ return ret;
+}
diff --git a/unit-tests/regex/parse_t.c b/unit-tests/regex/parse_t.c
new file mode 100644
index 00000000..54ebb0bf
--- /dev/null
+++ b/unit-tests/regex/parse_t.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* hack - using unexported internal function */
+#define DEBUG
+#include "regex/parse_rx.c"
+
+#include <stdio.h>
+#include <ctype.h>
+
+static void _pretty_print(struct rx_node *rx, int depth)
+{
+ int i;
+ for (i = 0; i < depth; i++)
+ printf(" ");
+
+ /* display info about the node */
+ switch (rx->type) {
+ case CAT:
+ printf("Cat");
+ break;
+
+ case OR:
+ printf("Or");
+ break;
+
+ case STAR:
+ printf("Star");
+ break;
+
+ case PLUS:
+ printf("Plus");
+ break;
+
+ case QUEST:
+ printf("Quest");
+ break;
+
+ case CHARSET:
+ printf("Charset : ");
+ for (i = 0; i < 256; i++) {
+ if (dm_bit(rx->charset, i) && isprint(i))
+ printf("%c", (char) i);
+ }
+ break;
+
+ default:
+ printf("Unknown type");
+ }
+ printf("\n");
+
+ if (rx->left)
+ _pretty_print(rx->left, depth + 1);
+
+ if (rx->right)
+ _pretty_print(rx->right, depth + 1);
+}
+
+int main(int argc, char **argv)
+{
+ struct dm_pool *mem;
+ struct rx_node *rx;
+ int regex_print = 0;
+ int show_nodes = 0;
+ int regex_arg = 1;
+
+ if (argc == 3 && !strcmp(argv[1], "-r")) {
+ regex_print++;
+ regex_arg++;
+ argc--;
+ }
+
+ if (argc == 3 && !strcmp(argv[1], "-R")) {
+ regex_print++;
+ show_nodes++;
+ regex_arg++;
+ argc--;
+ }
+
+ if (argc != 2) {
+ fprintf(stderr, "Usage : %s [-r] <regex>\n", argv[0]);
+ exit(0);
+ }
+
+ dm_log_init_verbose(_LOG_DEBUG);
+
+ if (!(mem = dm_pool_create("parse_regex", 1024))) {
+ fprintf(stderr, "Couldn't create pool\n");
+ exit(1);
+ }
+
+ if (!(rx = rx_parse_str(mem, argv[regex_arg]))) {
+ dm_pool_destroy(mem);
+ fprintf(stderr, "Couldn't parse regex\n");
+ exit(1);
+ }
+
+ if (regex_print)
+ _regex_print(rx, 0, show_nodes);
+ else
+ _pretty_print(rx, 0);
+
+ dm_pool_destroy(mem);
+
+ return 0;
+}