Skip to contentSkip to conversation

LVM2 libdm/libdevmapper.h libdm/regex/matcher. ...

PATCH [email protected] 1 participant 1 message Jul 20, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: thornber at sourceware.org 2010-07-20 15:32:07

Modified files:
libdm : libdevmapper.h
libdm/regex : matcher.c
unit-tests/regex: matcher_t.c matcher_t.expected

Log message:
[REGEX] add a fingerprinting facility to allow test code to compare dfas

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.121&r2=1.122
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/regex/matcher.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/unit-tests/regex/matcher_t.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/unit-tests/regex/matcher_t.expected.diff?cvsroot=lvm2&r1=1.1&r2=1.2

libdm/libdevmapper.h +8 -0
@@ -1007,6 +1007,14 @@
  */
 int dm_regex_match(struct dm_regex *regex, const char *s);
 
+/*
+ * This is useful for regression testing only.  The idea is if two
+ * fingerprints are different, then the two dfas are certainly not
+ * isomorphic.  If two fingerprints _are_ the same then it's very likely
+ * that the dfas are isomorphic.
+ */
+uint32_t dm_regex_fingerprint(struct dm_regex *regex);
+
 /*********************
  * reporting functions
  *********************/
libdm/regex/matcher.c +123 -0

126 lines not on this page · raw message

unit-tests/regex/matcher_t.c +1 -0
@@ -135,6 +135,7 @@
 		goto err;
 	}
 
+        printf("fingerprint: %x\n", dm_regex_fingerprint(scanner));
 	_scan_input(scanner, regex);
 	_free_regex(regex, nregex);
 
unit-tests/regex/matcher_t.expected +1 -0
@@ -1,4 +1,5 @@
 Matcher built with 23 dfa states
+fingerprint: 352b6c4f
 /dev/loop/0 : loop/[0-9]+
 /dev/loop/1 : loop/[0-9]+
 /dev/loop/2 : loop/[0-9]+