* Regex PCRE tests failure under windows
@ 2017-08-03 10:28 Fabrice Popineau
2017-08-03 11:52 ` Fabrice Popineau
0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Popineau @ 2017-08-03 10:28 UTC (permalink / raw)
To: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1770 bytes --]
I have this test failure on PCRE regex tests (emacs-master, mingw64) :
$ cat test/src/regex-tests.log
Running 22 tests (2017-08-01 22:21:34+0200)
passed 1/22 regex-tests-BOOST
Test regex-tests-PCRE backtrace:
Test regex-tests-PCRE condition:
(wrong-type-argument stringp nil)
FAILED 2/22 regex-tests-PCRE
The failure occurs here in PCRE.tests :
caterpillar caterpillar23
0: caterpillar caterpillar23
1: caterpillar
2: erpillar
3: <unset>
4:
5: 3
The variable which is nil instead of being a string is `pattern'
in (if (string-match pattern string) nil 'search-failed)`' :
(defun regex-tests-PCRE ()
(let (failures
pattern icase string what-failed matches-observed)
(regex-tests-generic-line
?# "PCRE.tests" regex-tests-PCRE-whitelist
(cond
;; pattern
((save-excursion (re-search-forward "^/\\(.*\\)/\\(.*i?\\)$" nil t))
(setq icase (string= "i" (match-string 2))
pattern (regex-tests-unextend (match-string 1))))
;; string. read it in, match against pattern, and save all the results
((save-excursion (re-search-forward "^ \\(.*\\)" nil t))
(let ((case-fold-search icase))
(setq string (match-string 1)
;; the regex match under test
what-failed
(condition-case nil
(if (string-match pattern string) nil 'search-failed)
('invalid-regexp 'compilation-failed))
matches-observed
(cl-loop for x from 0 to 20
collect (and (not what-failed)
(or (match-string x string)
"<unset>")))))
nil)
But I have no idea why pattern is losing its value ?
Any clue ?
Regards,
Fabrice
[-- Attachment #2: Type: text/html, Size: 2771 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Regex PCRE tests failure under windows
2017-08-03 10:28 Regex PCRE tests failure under windows Fabrice Popineau
@ 2017-08-03 11:52 ` Fabrice Popineau
0 siblings, 0 replies; 2+ messages in thread
From: Fabrice Popineau @ 2017-08-03 11:52 UTC (permalink / raw)
To: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 2912 bytes --]
Trying to understand this issue a little bit more.
Actually, the failure I see occurs a little bit earlier in PCRE.tests, at
lines :
/(cat(a(ract|tonic)|erpillar)) \1()2(3)/
cataract cataract23
0: cataract cataract23
1: cataract
2: aract
3: ract
-> 4:
5: 3
In function `regex-tests-PCRE', there are 4 cases testes in sequence, and
in case of failure, there is a catch-all reset which sets the pattern back
to nil.
The regex that should catch the line starting by "4:" is :
;; verification line: succeeded match
((save-excursion (re-search-forward "^ *\\([0-9]+\\): \\(.*\\)" nil
t))
But notice that there is a space after the colon, so the line is not
matched and the reset occurs in the test. The patter is set back to nil and
there is a failure when
reaching the PCRE.tests line starting by "5:".
Could it be that there is a space in PCRE.tests at end of line "4: " and
that git has removed it ?
Fabrice
2017-08-03 12:28 GMT+02:00 Fabrice Popineau <fabrice.popineau@gmail.com>:
>
> I have this test failure on PCRE regex tests (emacs-master, mingw64) :
>
> $ cat test/src/regex-tests.log
> Running 22 tests (2017-08-01 22:21:34+0200)
> passed 1/22 regex-tests-BOOST
> Test regex-tests-PCRE backtrace:
> Test regex-tests-PCRE condition:
> (wrong-type-argument stringp nil)
> FAILED 2/22 regex-tests-PCRE
>
>
> The failure occurs here in PCRE.tests :
>
> caterpillar caterpillar23
> 0: caterpillar caterpillar23
> 1: caterpillar
> 2: erpillar
> 3: <unset>
> 4:
> 5: 3
>
> The variable which is nil instead of being a string is `pattern'
> in (if (string-match pattern string) nil 'search-failed)`' :
>
> (defun regex-tests-PCRE ()
> (let (failures
> pattern icase string what-failed matches-observed)
> (regex-tests-generic-line
> ?# "PCRE.tests" regex-tests-PCRE-whitelist
>
> (cond
>
> ;; pattern
> ((save-excursion (re-search-forward "^/\\(.*\\)/\\(.*i?\\)$" nil t))
> (setq icase (string= "i" (match-string 2))
> pattern (regex-tests-unextend (match-string 1))))
>
> ;; string. read it in, match against pattern, and save all the
> results
> ((save-excursion (re-search-forward "^ \\(.*\\)" nil t))
> (let ((case-fold-search icase))
> (setq string (match-string 1)
>
> ;; the regex match under test
> what-failed
> (condition-case nil
> (if (string-match pattern string) nil 'search-failed)
> ('invalid-regexp 'compilation-failed))
>
> matches-observed
> (cl-loop for x from 0 to 20
> collect (and (not what-failed)
> (or (match-string x string)
> "<unset>")))))
> nil)
>
> But I have no idea why pattern is losing its value ?
>
> Any clue ?
>
> Regards,
>
> Fabrice
>
>
[-- Attachment #2: Type: text/html, Size: 4470 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-03 11:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-03 10:28 Regex PCRE tests failure under windows Fabrice Popineau
2017-08-03 11:52 ` Fabrice Popineau
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).