Discussion:
Can someone update the tex2lyx files to format 475??
Scott Kostyshak
2014-05-12 07:34:10 UTC
Permalink
The tex2lyx tests are failing for me because of the recent format
change. Can someone update the files?

I tried to do so by running
${LYX2LYX} "$1" > temp.lyx && mv temp.lyx "$1"
on all .lyx files in src/tex2lyx/test

I got the following warnings:
Warning: #LyX file created by tex2lyx 2.1

Why is this a warning? As long as lyx2lyx finds \lyxformat why does it
care who made the file?

In any case, at this point I realized the fix is a little more
complicated because I need to run tex2lyx on the files so I wanted to
check in here first to see what the process is for updating the files
and if someone has automated it.

Scott
Kornel Benko
2014-05-12 08:36:32 UTC
Permalink
Post by Scott Kostyshak
The tex2lyx tests are failing for me because of the recent format
change. Can someone update the files?
I tried to do so by running
${LYX2LYX} "$1" > temp.lyx && mv temp.lyx "$1"
on all .lyx files in src/tex2lyx/test
Warning: #LyX file created by tex2lyx 2.1
Why is this a warning? As long as lyx2lyx finds \lyxformat why does it
care who made the file?
The message says it all: files are not created by lyx2lyx but tex2lyx.
Post by Scott Kostyshak
In any case, at this point I realized the fix is a little more
complicated because I need to run tex2lyx on the files so I wanted to
check in here first to see what the process is for updating the files
and if someone has automated it.
I run one test.
# ctest -R tex2lyx/cmplyx/box-color-size-space-align.tex
==> FAILED

Look into Testing/Temporary/LastTest.log I see diff of
/usr/BUILD/BuildLyxGit/src/tex2lyx/test/box-color-size-space-align.lyx
and
/usr/src/lyx/lyx-git/src/tex2lyx/test/box-color-size-space-align.lyx.lyx

If the differences are OK for me, I can then copy
/usr/BUILD/BuildLyxGit/src/tex2lyx/test/box-color-size-space-align.lyx
over
/usr/src/lyx/lyx-git/src/tex2lyx/test/box-color-size-space-align.lyx.lyx

There should be nothing automated. We should always check the diffs IMHO.
Post by Scott Kostyshak
Scott
Kornel
Enrico Forestieri
2014-05-12 18:30:56 UTC
Permalink
Post by Kornel Benko
I run one test.
# ctest -R tex2lyx/cmplyx/box-color-size-space-align.tex
==> FAILED
I think that the test should not take into account the first two lines
of the LyX documents. Indeed, there is no reason for failure in this case.
Look:

$ ../../../build/src/tex2lyx/tex2lyx box-color-size-space-align.tex box-color-size-space-align.lyx
Creating file /usr/local/src/lyx/lyx-devel/src/tex2lyx/test/box-color-size-space-align.lyx
$ diff -u -I '^#LyX' -I '^\\lyxformat' box-color-size-space-align.lyx.lyx box-color-size-space-align.lyx
<no output>

So, the only difference is in the first two lines and the test should
succeed. However, I don't know what is the rationale of these tests.
--
Enrico
Georg Baum
2014-05-12 19:41:50 UTC
Permalink
Post by Enrico Forestieri
I think that the test should not take into account the first two lines
of the LyX documents. Indeed, there is no reason for failure in this case.
$ ../../../build/src/tex2lyx/tex2lyx box-color-size-space-align.tex
box-color-size-space-align.lyx Creating file
/usr/local/src/lyx/lyx-devel/src/tex2lyx/test/box-color-size-space-
align.lyx
Post by Enrico Forestieri
$ diff -u -I '^#LyX' -I '^\\lyxformat' box-color-size-space-align.lyx.lyx
box-color-size-space-align.lyx <no output>
So, the only difference is in the first two lines and the test should
succeed. However, I don't know what is the rationale of these tests.
This has been discussed at length in the past. The very first line does not
need to be compared (it is only a comment), but the second one is important.
For example, if the file format number would be ignored, and you had updated
LYX_FORMAT_TEX2LYX, but forgot the change in src/tex2lyx/text.cpp, then all
tests would still have been passed, although test-structure.lyx would be
invalid (file format 475, but still using the old separator layout).
Therefore, a new file format number invalidates all tests, and one needs to
manually verify whether the new output is still OK (for the current change I
did that by searching for --Separator-- in all updated test references, but
of course the details of the verify step depend strongly on the nature of
the file format update).


Georg
Enrico Forestieri
2014-05-12 20:24:12 UTC
Permalink
Post by Kornel Benko
Post by Enrico Forestieri
I think that the test should not take into account the first two lines
of the LyX documents. Indeed, there is no reason for failure in this case.
$ ../../../build/src/tex2lyx/tex2lyx box-color-size-space-align.tex
box-color-size-space-align.lyx Creating file
/usr/local/src/lyx/lyx-devel/src/tex2lyx/test/box-color-size-space-
align.lyx
Post by Enrico Forestieri
$ diff -u -I '^#LyX' -I '^\\lyxformat' box-color-size-space-align.lyx.lyx
box-color-size-space-align.lyx <no output>
So, the only difference is in the first two lines and the test should
succeed. However, I don't know what is the rationale of these tests.
This has been discussed at length in the past. The very first line does not
need to be compared (it is only a comment), but the second one is important.
For example, if the file format number would be ignored, and you had updated
LYX_FORMAT_TEX2LYX, but forgot the change in src/tex2lyx/text.cpp, then all
tests would still have been passed, although test-structure.lyx would be
invalid (file format 475, but still using the old separator layout).
Therefore, a new file format number invalidates all tests, and one needs to
manually verify whether the new output is still OK (for the current change I
did that by searching for --Separator-- in all updated test references, but
of course the details of the verify step depend strongly on the nature of
the file format update).
I see. Thanks for the clarification.
--
Enrico
Enrico Forestieri
2014-05-12 18:23:42 UTC
Permalink
Post by Scott Kostyshak
The tex2lyx tests are failing for me because of the recent format
change. Can someone update the files?
I tried to do so by running
${LYX2LYX} "$1" > temp.lyx && mv temp.lyx "$1"
on all .lyx files in src/tex2lyx/test
Warning: #LyX file created by tex2lyx 2.1
Why is this a warning? As long as lyx2lyx finds \lyxformat why does it
care who made the file?
In any case, at this point I realized the fix is a little more
complicated because I need to run tex2lyx on the files so I wanted to
check in here first to see what the process is for updating the files
and if someone has automated it.
I have no idea. However, after running tex2lyx there should be no difference
(apart from the first two lines of the generated LyX document), except if
the .tex file had two same environments one after the other, without
anything in between. In this case, the only difference should be that
a plain separator inset is inserted instead of the old layout separator.
--
Enrico
Georg Baum
2014-05-12 19:33:39 UTC
Permalink
Post by Enrico Forestieri
Post by Scott Kostyshak
The tex2lyx tests are failing for me because of the recent format
change. Can someone update the files?
I tried to do so by running
${LYX2LYX} "$1" > temp.lyx && mv temp.lyx "$1"
on all .lyx files in src/tex2lyx/test
Warning: #LyX file created by tex2lyx 2.1
Why is this a warning? As long as lyx2lyx finds \lyxformat why does it
care who made the file?
Because lyx2lyx tries to read the LyX version from that file (see
read_version() in LyX.py), and this fails. lyx2lyx should be teached about
tex2lyx, then the warning would vanish.
Post by Enrico Forestieri
Post by Scott Kostyshak
In any case, at this point I realized the fix is a little more
complicated because I need to run tex2lyx on the files so I wanted to
check in here first to see what the process is for updating the files
and if someone has automated it.
It is automated. Please read section 3.2.2 of lib/doc/Development.lyx.
Kornel is right, you need to look at the diffs manually in order to judge
whether the updated references are OK, but the process of producing them and
copying them where git expects them is automated (and needs to be automated
- nobody would copy over all these files by hand).
Post by Enrico Forestieri
I have no idea. However, after running tex2lyx there should be no
difference (apart from the first two lines of the generated LyX document),
except if the .tex file had two same environments one after the other,
without anything in between. In this case, the only difference should be
that a plain separator inset is inserted instead of the old layout
separator.
The procedure of updating a file format is documented in section 2.3 of
lib/doc/Development.lyx. Your update was perfect (including tex2lyx support
- this is often not done), the only missing bit was the update of the test
references. I verified that the new code is correct and did the update.


Georg
Enrico Forestieri
2014-05-12 20:39:32 UTC
Permalink
Post by Georg Baum
The procedure of updating a file format is documented in section 2.3 of
lib/doc/Development.lyx.
Doh! I was missing that. Sorry.
Post by Georg Baum
I verified that the new code is correct and did the update.
Thank you. I had manually checked the tests but was unsure about
what to do.
--
Enrico
Scott Kostyshak
2014-05-13 08:08:26 UTC
Permalink
On Mon, May 12, 2014 at 3:33 PM, Georg Baum
Post by Georg Baum
Post by Scott Kostyshak
In any case, at this point I realized the fix is a little more
complicated because I need to run tex2lyx on the files so I wanted to
check in here first to see what the process is for updating the files
and if someone has automated it.
It is automated. Please read section 3.2.2 of lib/doc/Development.lyx.
Kornel is right, you need to look at the diffs manually in order to judge
whether the updated references are OK, but the process of producing them and
copying them where git expects them is automated (and needs to be automated
- nobody would copy over all these files by hand).
Perfect. Thanks, Scott

Loading...