On Fri, Jan 25, 2013 at 4:00 AM, Scott Kostyshak <skost...@lyx.org> wrote:
> On Fri, Jan 25, 2013 at 3:30 AM, Kornel Benko <kor...@lyx.org> wrote:
>> Am Donnerstag, 24. Januar 2013 um 21:02:52, schrieb Scott Kostyshak
>> <skost...@lyx.org>
>>
>>> On Thu, Jan 24, 2013 at 8:50 PM, Tommaso Cucinotta <tomm...@lyx.org>
>>> wrote:
>>
>>> > On 24/01/13 04:42, Scott Kostyshak wrote:
>>
>>> >> I am trying to add an autotest for #8523, but how can I open a .lyx
>>
>>> >> file that I need to reproduce the crash?
>>
>>> >>
>>
>>> >> Two solutions come to mind:
>>
>>> >>
>>
>>> >> 1. Allow for a macro [autotest-dir] that key-test.py will replace with
>>
>>> >> the autotest directory.
>>
>>> >
>>
>>> > As of now, when launched through run-tests.sh, the tests execute in a
>>> > child
>>
>>> > directory of the autotests/ folder, named after out-<name-of-test>/.
>>
>>> >
>>
>>> > Therefore, this works:
>>
>>> >
>>
>>> > TestBegin ../bug-8523.lyx > lyx-log.txt 2>&1
>>
>>> >
>>
>>> > Though, the test should not try to modify the file (e.g., forcing Ctrl-S
>>> > or similar).
>>
>>> >
>>
>>> > Also, don't know whether it works when launched through the cmake
>>> > infrastructure.
>>
>>> >
>>
>>> > Would that suffice/work with cmake?
>>
>>>
>>
>>> Not currently. The tests are run in the CMake user build directory,
>>
>>> which can be anywhere and is specified by the user. CMake must know
>>
>>> where the source path is though because it knows this information when
>>
>>> building so hopefully Kornel will have an idea.
>>
>>
>>
>> "test.lyx" already is in the build directory (autotests/out-home/), so
>> ../bug-8523.lyx
>>
>> would be in build directory "autotests". What is the problem? Copy an
>> existing .lyx-files to build-dir?
>>
>> Should be easy.
>
> Ah yes you're right. You are convincing me more and more that
> out-of-source builds have many advantages and no disadvantages. So all
> is needed is just to copy the .lyx file there.
>
> Scott

Please see the attached patches. Everything works fine under CMake,
except that another mystery (for me, at least) has appeared. The new
autotest only works for me if I revert the XVKBD_HACKED commit
(dae22baf). If that commit is left in, everything works fine except
that \[Return] does not get rid of the warning that is given on
opening the .lyx file. If you quickly press return manually, the rest
of the test works fine. This same behavior happens under autotools
with XVKBD_HACKED set. (Note that I haven't figured out yet how to run
the autotools tests without setting XVKBD_HACKED so I can't test
that.)

Why would there be this difference depending on XVKBD_HACKED? The most
surprising thing is that my system version of xvkbd was installed from
the version in LyX (with make install) so I don't think it could be
differences in the versions.

Note that the attached autotest should currently fail because #8523 is
not fixed yet.

Any ideas?

Kornel, do you have any comments on the CMake patch?

Thanks,

Scott
From 40d8075fb1c48685fd584d9734d18510628f9eee Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Sun, 27 Jan 2013 00:24:46 -0500
Subject: [PATCH 1/2] CMake: tests can now use an existing .lyx file

To reproduce some bugs, tests need to open an existing LyX file. This
is now possible with CMake and is consistent with testing under
autotools in the sense that the .lyx file is referred to in the test
by being in the parent directory.

If the test is named bug-XXXX-in.txt and there exists a file
bug-XXXX.lyx, that file will be copied to the parent directory of
out-home in the build directory.
---
 development/autotests/single-test.cmake |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/development/autotests/single-test.cmake 
b/development/autotests/single-test.cmake
index 15452a6..8837eba 100755
--- a/development/autotests/single-test.cmake
+++ b/development/autotests/single-test.cmake
@@ -73,6 +73,11 @@ if(_testfiles)
   execute_process(
   COMMAND ${CMAKE_COMMAND} -E remove -f ${_testfiles} )
 endif()
+string(REGEX REPLACE "-in\\.(txt|sh)" "" _jj ${KEYTEST_INFILE})
+string(REGEX REPLACE "/out-home" "" BUILD_DIR ${WORKDIR})
+if(EXISTS "${AUTOTEST_ROOT}/${_jj}.lyx")
+  configure_file("${AUTOTEST_ROOT}/${_jj}.lyx" ${BUILD_DIR})
+endif()
 execute_process(
   COMMAND python ${KEYTEST}
   RESULT_VARIABLE KEYTEST_RES)
-- 
1.7.9.5

From c2aae44a1289f654f90c174254926061993c96b4 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Sun, 27 Jan 2013 01:45:17 -0500
Subject: [PATCH 2/2] Add an autotest for #8523

This patch adds an autotest for #8523. It is the first autotest that
uses an existing .lyx file, bug-8523.lyx.

Bug #8523 has not been fixed yet so this test is expected to fail at
this point.
---
 development/autotests/bug-8523-in.txt |   10 +++++
 development/autotests/bug-8523.lyx    |   70 +++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)
 create mode 100644 development/autotests/bug-8523-in.txt
 create mode 100644 development/autotests/bug-8523.lyx

diff --git a/development/autotests/bug-8523-in.txt 
b/development/autotests/bug-8523-in.txt
new file mode 100644
index 0000000..338d653
--- /dev/null
+++ b/development/autotests/bug-8523-in.txt
@@ -0,0 +1,10 @@
+# regression in branch: SIGSEGV when saving with a module that doesn't exist 
(#8523)
+#
+Lang en_US.utf8
+TestBegin ../bug-8523.lyx > lyx-log.txt 2>&1
+KK: \[Return]
+KK: \Ax
+KK: buffer-write-as /tmp/temp-8523.lyx\[Return]
+Sleep 5
+Exec rm /tmp/temp-8523.lyx
+TestEnd
diff --git a/development/autotests/bug-8523.lyx 
b/development/autotests/bug-8523.lyx
new file mode 100644
index 0000000..aa54763
--- /dev/null
+++ b/development/autotests/bug-8523.lyx
@@ -0,0 +1,70 @@
+#LyX 2.1 created this file. For more info see http://www.lyx.org/
+\lyxformat 413
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\begin_modules
+DOESNOTEXIST
+\end_modules
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\spacing single
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_amsmath 1
+\use_esint 1
+\use_mathdots 1
+\use_mhchem 1
+\cite_engine basic
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Standard
+testing...
+\end_layout
+
+\end_body
+\end_document
-- 
1.7.9.5

Reply via email to