]> git.lyx.org Git - lyx.git/blob - lib/doc/Development.lyx
a33f13cf3bb75c8120c7bca36223a797a84c088d
[lyx.git] / lib / doc / Development.lyx
1 #LyX 2.2 created this file. For more info see http://www.lyx.org/
2 \lyxformat 503
3 \begin_document
4 \begin_header
5 \origin /systemlyxdir/doc/
6 \textclass scrartcl
7 \options BCOR8mm,captions=tableheading
8 \use_default_options false
9 \begin_modules
10 logicalmkup
11 \end_modules
12 \maintain_unincluded_children false
13 \language english
14 \language_package default
15 \inputencoding auto
16 \fontencoding global
17 \font_roman "lmodern" "default"
18 \font_sans "lmss" "default"
19 \font_typewriter "lmtt" "default"
20 \font_math "auto" "auto"
21 \font_default_family default
22 \use_non_tex_fonts false
23 \font_sc false
24 \font_osf false
25 \font_sf_scale 100 100
26 \font_tt_scale 100 100
27 \graphics default
28 \default_output_format default
29 \output_sync 0
30 \bibtex_command default
31 \index_command default
32 \paperfontsize 12
33 \spacing single
34 \use_hyperref true
35 \pdf_title "LyX's Development manual"
36 \pdf_author "LyX Team"
37 \pdf_subject "LyX's development documentation"
38 \pdf_keywords "LyX, Documentation, Development"
39 \pdf_bookmarks true
40 \pdf_bookmarksnumbered true
41 \pdf_bookmarksopen true
42 \pdf_bookmarksopenlevel 1
43 \pdf_breaklinks false
44 \pdf_pdfborder false
45 \pdf_colorlinks true
46 \pdf_backref false
47 \pdf_pdfusetitle false
48 \pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue, pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false"
49 \papersize a4paper
50 \use_geometry false
51 \use_package amsmath 1
52 \use_package amssymb 1
53 \use_package cancel 0
54 \use_package esint 0
55 \use_package mathdots 1
56 \use_package mathtools 0
57 \use_package mhchem 1
58 \use_package stackrel 0
59 \use_package stmaryrd 0
60 \use_package undertilde 0
61 \cite_engine basic
62 \cite_engine_type default
63 \biblio_style plain
64 \use_bibtopic false
65 \use_indices false
66 \paperorientation portrait
67 \suppress_date false
68 \justification true
69 \use_refstyle 0
70 \notefontcolor #0000ff
71 \index Index
72 \shortcut idx
73 \color #008000
74 \end_index
75 \secnumdepth 4
76 \tocdepth 4
77 \paragraph_separation indent
78 \paragraph_indentation default
79 \quotes_language english
80 \papercolumns 1
81 \papersides 2
82 \paperpagestyle headings
83 \tracking_changes false
84 \output_changes false
85 \html_math_output 0
86 \html_css_as_file 0
87 \html_be_strict true
88 \end_header
89
90 \begin_body
91
92 \begin_layout Title
93 Developing \SpecialChar LyX
94
95 \end_layout
96
97 \begin_layout Subtitle
98 Version 2.2.x
99 \end_layout
100
101 \begin_layout Author
102 by the \SpecialChar LyX
103  Team
104 \begin_inset Foot
105 status collapsed
106
107 \begin_layout Plain Layout
108 \noindent
109 If you have comments or error corrections, please send them to the \SpecialChar LyX
110  Documentatio
111 n mailing list, 
112 \begin_inset Flex Code
113 status collapsed
114
115 \begin_layout Plain Layout
116 \noindent
117 <lyx-docs@lists.lyx.org>
118 \end_layout
119
120 \end_inset
121
122 .
123 \end_layout
124
125 \end_inset
126
127
128 \end_layout
129
130 \begin_layout Standard
131 \begin_inset CommandInset toc
132 LatexCommand tableofcontents
133
134 \end_inset
135
136
137 \end_layout
138
139 \begin_layout Section
140 Introduction
141 \end_layout
142
143 \begin_layout Standard
144 This manual documents some aspects of \SpecialChar LyX
145  development.
146  It is currently rather incomplete, but will hopefully be extended in the
147  future.
148  Meanwhile, additional information can be found in the 
149 \begin_inset Flex Code
150 status collapsed
151
152 \begin_layout Plain Layout
153 development
154 \end_layout
155
156 \end_inset
157
158  subfolder of the \SpecialChar LyX
159  source code distribution.
160  This document is not translated, since the development language of \SpecialChar LyX
161  is
162  english.
163  If you want to use \SpecialChar LyX
164  you don't need to read this manual.
165  However, if you want to learn more about how \SpecialChar LyX
166  is developed, or even want
167  to participate in \SpecialChar LyX
168  development, you may find some interesting information.
169 \end_layout
170
171 \begin_layout Section
172 File formats
173 \end_layout
174
175 \begin_layout Standard
176 \SpecialChar LyX
177  uses several custom file formats for configuration files and documents.
178  This chapter contains some background concerning these file formats.
179  Several file formats are also described in detail in the regular user documenta
180 tion.
181 \end_layout
182
183 \begin_layout Subsection
184 File Format Numbers
185 \end_layout
186
187 \begin_layout Subsection
188 When is an update of the .lyx file format number needed?
189 \begin_inset CommandInset label
190 LatexCommand label
191 name "sec:When-is-an"
192
193 \end_inset
194
195
196 \end_layout
197
198 \begin_layout Standard
199 When you are working on a new feature you may ask yourself whether it needs
200  an update of the .lyx file format number.
201  Whether an update is needed or not is not always obvious.
202  Below you can find a list of reasons for file format updates with explanations:
203 \end_layout
204
205 \begin_layout Description
206 New
207 \begin_inset space ~
208 \end_inset
209
210 document
211 \begin_inset space ~
212 \end_inset
213
214 setting Whenever you introduce a new setting that is stored in the document
215  header, a file format update is needed.
216  This is also true if you add a new valid value to an existing setting,
217  e.
218 \begin_inset space \thinspace{}
219 \end_inset
220
221 g.
222 \begin_inset space \space{}
223 \end_inset
224
225 a new language that is stored in 
226 \begin_inset Flex Code
227 status collapsed
228
229 \begin_layout Plain Layout
230
231 \backslash
232 language
233 \end_layout
234
235 \end_inset
236
237 .
238 \end_layout
239
240 \begin_layout Description
241 Removed
242 \begin_inset space ~
243 \end_inset
244
245 document
246 \begin_inset space ~
247 \end_inset
248
249 setting If a certain setting becomes obsolete and gets removed, a file format
250  update is needed.
251 \end_layout
252
253 \begin_layout Description
254 New
255 \begin_inset space ~
256 \end_inset
257
258 inset Of course a new inset requires a file format update.
259 \end_layout
260
261 \begin_layout Description
262 New
263 \begin_inset space ~
264 \end_inset
265
266 style in any layout file or module shipped with \SpecialChar LyX
267 , or new shipped layout
268  file or module.
269  These requirements are currently under discussion and might change in the
270  future.
271 \end_layout
272
273 \begin_layout Description
274 Automatically
275 \begin_inset space ~
276 \end_inset
277
278 loaded
279 \begin_inset space ~
280 \end_inset
281
282 math
283 \begin_inset space ~
284 \end_inset
285
286 package Any new math package that is automatically loaded needs a file format
287  update.
288  The reason for this is that there is no true ERT inset for math formulas:
289  Each command is parsed, and if a user happens to defne a local command
290  with the same name as a command that triggers an automatic load of a package,
291  he needs to be able to switch off the automatic loading of that package.
292  This switch is stored by the 
293 \begin_inset Flex Code
294 status collapsed
295
296 \begin_layout Plain Layout
297 use_package
298 \end_layout
299
300 \end_inset
301
302  header setting.
303 \end_layout
304
305 \begin_layout Standard
306 If you are still unsure, please ask on the development list.
307 \end_layout
308
309 \begin_layout Subsection
310 How to update the file format number of .lyx files
311 \begin_inset CommandInset label
312 LatexCommand label
313 name "subsec:update_lyx_files"
314
315 \end_inset
316
317
318 \end_layout
319
320 \begin_layout Standard
321 Once you came to the conclusion that a file format update is needed you
322  should use the following procedure to perform the update:
323 \end_layout
324
325 \begin_layout Enumerate
326 Implement and test the new feature, including the reading and writing of
327  .lyx files.
328  Note that any file produced at this stage does not use a valid format,
329  so do not use this version of \SpecialChar LyX
330  for working on any important documents.
331 \end_layout
332
333 \begin_layout Enumerate
334 Describe the new format in 
335 \begin_inset Flex Code
336 status collapsed
337
338 \begin_layout Plain Layout
339 development/FORMAT
340 \end_layout
341
342 \end_inset
343
344 .
345 \end_layout
346
347 \begin_layout Enumerate
348 Update the \SpecialChar LyX
349  file format number in 
350 \begin_inset Flex Code
351 status collapsed
352
353 \begin_layout Plain Layout
354 src/version.h
355 \end_layout
356
357 \end_inset
358
359 .
360 \end_layout
361
362 \begin_layout Enumerate
363 Update the range of file formats in the array 
364 \begin_inset Flex Code
365 status collapsed
366
367 \begin_layout Plain Layout
368 format_relation
369 \end_layout
370
371 \end_inset
372
373  in 
374 \begin_inset Flex Code
375 status collapsed
376
377 \begin_layout Plain Layout
378 lib/lyx2lyx/LyX.py
379 \end_layout
380
381 \end_inset
382
383 .
384 \end_layout
385
386 \begin_layout Enumerate
387 Add an entry to both format lists (for conversion and reversion) in
388 \begin_inset Newline newline
389 \end_inset
390
391
392 \begin_inset Flex Code
393 status collapsed
394
395 \begin_layout Plain Layout
396 lib/lyx2lyx/lyx_2_2.py
397 \end_layout
398
399 \end_inset
400
401 .
402  Add a conversion routine if needed (e.
403 \begin_inset space \thinspace{}
404 \end_inset
405
406 g.
407 \begin_inset space \space{}
408 \end_inset
409
410 a new header setting always needs a conversion that adds the new setting,
411  a new document language does not need one).
412  Add a reversion routine if needed.
413  While the conversion routine is required to produce a document that is
414  equivalent to the old version, the requirements of the reversion are not
415  that strict.
416  If possible, try to produce a proper reversion, using ERT if needed, but
417  for some features this might be too complicated.
418  In this case, the minimum requirement of the reversion routine is that
419  it produces a valid document which can be read by an older \SpecialChar LyX
420 .
421  If absolutely needed, even data loss is allowed for the reversion.
422 \end_layout
423
424 \begin_layout Enumerate
425 Since tex2lyx has several implicit file format dependencies caused by sharing
426  code with \SpecialChar LyX
427 , updating the file format of .lyx files produced by tex2lyx at
428  the same time as updating the main .lyx file format is strongly recommended.
429  Therefore, a compiler warning will be issued if the \SpecialChar LyX
430  and tex2lyx .lyx file
431  format numbers differ.
432  In many cases the tex2lyx update requires only the first and last item
433  of the list below:
434 \begin_inset Separator parbreak
435 \end_inset
436
437
438 \end_layout
439
440 \begin_deeper
441 \begin_layout Enumerate
442 Update the tex2lyx file format number in 
443 \begin_inset Flex Code
444 status collapsed
445
446 \begin_layout Plain Layout
447 src/version.h
448 \end_layout
449
450 \end_inset
451
452 .
453 \end_layout
454
455 \begin_layout Enumerate
456 If the lyx2lyx conversion from the old to the new format is empty, or if
457  tex2lyx does not yet output the changed feature, you do not need any further
458  tex2lyx changes.
459  Otherwise, search for the changed feature in tex2lyx, and adjust the output
460  according to the lyx2lyx changes.
461 \end_layout
462
463 \begin_layout Enumerate
464 Update the tex2lyx test references as described in 
465 \begin_inset CommandInset ref
466 LatexCommand formatted
467 reference "sec:Updating-test-references"
468
469 \end_inset
470
471 .
472 \end_layout
473
474 \end_deeper
475 \begin_layout Enumerate
476 If you did not implement full tex2lyx support of the new feature, add a
477  line to 
478 \begin_inset Flex Code
479 status collapsed
480
481 \begin_layout Plain Layout
482 src/tex2lyx/TODO.txt
483 \end_layout
484
485 \end_inset
486
487  describing the missing bits.
488  Note that it is perfectly fine if you do not add full tex2lyx support for
489  a new feature: The updating recommendation above is only issued for the
490  syntax of the produced .lyx file.
491  It is no problem if some features supported by \SpecialChar LyX
492  are still output as ERT
493  by tex2lyx, since the problems in the past that resulted in the update
494  recommendation were related to mixed version syntax, not ERT.
495 \end_layout
496
497 \begin_layout Enumerate
498 It would be nice if you could create a .lyx test file which contains instances
499  of all changed or added features.
500  This could then be used to test lyx2lyx and tex2lyx.
501  Unfortunately it has not yet been decided how to collect such examples,
502  so please ask on the development list if you want to create one.
503 \end_layout
504
505 \begin_layout Enumerate
506 \begin_inset CommandInset label
507 LatexCommand label
508 name "enu:updatefiles"
509
510 \end_inset
511
512 Update LyX's .lyx documentation files to the new format.
513  The developer who makes the change knows best what changes to expect when
514  inspecting the resulting diff.
515  Because of this, you might be able to catch a bug in the lyx2lyx code that
516  updates the format just by taking a quick scan through the large diff that
517  is the result
518 \begin_inset Note Note
519 status collapsed
520
521 \begin_layout Plain Layout
522 Another advantage is that if later we suspect a bug in lyx2lyx we can easily
523  see which layout update made an unexpected change by looking at the git
524  log of a .lyx file that suffers the problem.
525 \end_layout
526
527 \end_inset
528
529 .
530  To do this, first make sure that there are no changes to the git repository
531  that you will not want to commit (this is needed because it will be convenient
532  to commit with the command 
533 \begin_inset Flex Code
534 status collapsed
535
536 \begin_layout Plain Layout
537 git commit -a
538 \end_layout
539
540 \end_inset
541
542 ).
543  Then run the following command in the root folder of the source: 
544 \begin_inset Flex Code
545 status collapsed
546
547 \begin_layout Plain Layout
548 python development/tools/updatedocs.py
549 \end_layout
550
551 \end_inset
552
553 .
554  Then, revert the change to 
555 \begin_inset Flex Code
556 status collapsed
557
558 \begin_layout Plain Layout
559 LFUNs.lyx
560 \end_layout
561
562 \end_inset
563
564  because that file is meant to be generated separately: 
565 \begin_inset Flex Code
566 status collapsed
567
568 \begin_layout Plain Layout
569 git checkout lib/doc/LFUNs.lyx
570 \end_layout
571
572 \end_inset
573
574
575 \begin_inset Note Note
576 status collapsed
577
578 \begin_layout Plain Layout
579 TODO: this step should be done within updatedocs.py
580 \end_layout
581
582 \end_inset
583
584 .
585  Look at the resulting changes using the command 
586 \begin_inset Flex Code
587 status collapsed
588
589 \begin_layout Plain Layout
590 git diff
591 \end_layout
592
593 \end_inset
594
595 .
596  If anything looks surprising, please investigate.
597  Finally, commit using 
598 \begin_inset Flex Code
599 status collapsed
600
601 \begin_layout Plain Layout
602 git commit -a
603 \end_layout
604
605 \end_inset
606
607 .
608 \end_layout
609
610 \begin_layout Subsection
611 Updating the file format number of layout files
612 \end_layout
613
614 \begin_layout Standard
615 See step 
616 \begin_inset CommandInset ref
617 LatexCommand ref
618 reference "enu:updatefiles"
619
620 \end_inset
621
622  in section 
623 \begin_inset CommandInset ref
624 LatexCommand ref
625 reference "subsec:update_lyx_files"
626
627 \end_inset
628
629  but instead of the 
630 \begin_inset Flex Code
631 status collapsed
632
633 \begin_layout Plain Layout
634 updatedocs.py
635 \end_layout
636
637 \end_inset
638
639  command, use this command: 
640 \begin_inset Flex Code
641 status collapsed
642
643 \begin_layout Plain Layout
644 python development/tools/updatelayouts.py
645 \end_layout
646
647 \end_inset
648
649 .
650 \end_layout
651
652 \begin_layout Subsection
653 Updating the file format number of bind/ui files
654 \end_layout
655
656 \begin_layout Standard
657 See step 
658 \begin_inset CommandInset ref
659 LatexCommand ref
660 reference "enu:updatefiles"
661
662 \end_inset
663
664  in section 
665 \begin_inset CommandInset ref
666 LatexCommand ref
667 reference "subsec:update_lyx_files"
668
669 \end_inset
670
671  but instead of the 
672 \begin_inset Flex Code
673 status collapsed
674
675 \begin_layout Plain Layout
676 updatedocs.py
677 \end_layout
678
679 \end_inset
680
681  command, use this command: 
682 \begin_inset Flex Code
683 status collapsed
684
685 \begin_layout Plain Layout
686 bash development/tools/updatelfuns.sh
687 \end_layout
688
689 \end_inset
690
691 .
692 \end_layout
693
694 \begin_layout Subsection
695 Backporting new styles to the stable version
696 \end_layout
697
698 \begin_layout Standard
699 Starting with the stable \SpecialChar LyX
700  2.1 branch, there is a mechanism in place to backport
701  new styles to the stable version without the need to update the file format.
702  The basic idea is that the new style definition is automatically copied
703  to the document preamble, so that it can even be used by older minor revisions
704  that did not yet include the style.
705  To backport a new style to the stable version, the following steps are
706  needed:
707 \end_layout
708
709 \begin_layout Enumerate
710 Add the line 
711 \begin_inset Flex Code
712 status collapsed
713
714 \begin_layout Plain Layout
715 ForceLocal -1
716 \end_layout
717
718 \end_inset
719
720  to the style definition in the development version.
721 \end_layout
722
723 \begin_layout Enumerate
724 Copy the style definition to the stable version, but use 
725 \begin_inset Flex Code
726 status collapsed
727
728 \begin_layout Plain Layout
729 ForceLocal 1
730 \end_layout
731
732 \end_inset
733
734  instead.
735  If needed adjust the format to the one used by the stable version (see
736  the customization manual for details of the layout file format).
737 \end_layout
738
739 \begin_layout Enumerate
740 For each update of the style in a later stable version, increase the argument
741  of 
742 \begin_inset Flex Code
743 status collapsed
744
745 \begin_layout Plain Layout
746 ForceLocal
747 \end_layout
748
749 \end_inset
750
751  by one (in the stable version, the development version should not be touched).
752 \end_layout
753
754 \begin_layout Standard
755 For details about the 
756 \begin_inset Flex Code
757 status collapsed
758
759 \begin_layout Plain Layout
760 ForceLocal
761 \end_layout
762
763 \end_inset
764
765  flag see the customization manual.
766  No 
767 \begin_inset Flex Code
768 status collapsed
769
770 \begin_layout Plain Layout
771 lyx2lyx
772 \end_layout
773
774 \end_inset
775
776  support is needed for backported styles: Since the style of the development
777  version has an infinite version number, it will always be used.
778  Furthermore, since its version number is less than one, the style will
779  not be written anymore to the document header for files saved by the new
780  version.
781 \end_layout
782
783 \begin_layout Standard
784 \begin_inset Newpage newpage
785 \end_inset
786
787
788 \end_layout
789
790 \begin_layout Section
791 Tests
792 \end_layout
793
794 \begin_layout Standard
795 Automated tests are an important tool to detect bugs and regressions in
796  software development.
797  Some projects like gcc even require each bug fix to be accompanied by a
798  test case for the automatic test suite, that would detect this bug.
799  Testing interactive features automatically is of course very hard, but
800  core functionality like document import and export can be tested quite
801  easily, and some tests of this kind exist.
802 \end_layout
803
804 \begin_layout Subsection
805 \SpecialChar LyX
806  tests
807 \end_layout
808
809 \begin_layout Standard
810 Some tests are located in the 
811 \begin_inset Flex Code
812 status collapsed
813
814 \begin_layout Plain Layout
815 development/autotests
816 \end_layout
817
818 \end_inset
819
820  subfolder of the \SpecialChar LyX
821  source code distribution.
822 \end_layout
823
824 \begin_layout Subsubsection
825 Running the tests
826 \end_layout
827
828 \begin_layout Standard
829 cmake is required to run the \SpecialChar LyX
830  tests, running them is not implemented for
831  autotools.
832  The \SpecialChar LyX
833  tests can be run by the commands 
834 \begin_inset Flex Code
835 status collapsed
836
837 \begin_layout Plain Layout
838 ctest
839 \end_layout
840
841 \end_inset
842
843  (all platforms) or 
844 \begin_inset Flex Code
845 status collapsed
846
847 \begin_layout Plain Layout
848 make test
849 \end_layout
850
851 \end_inset
852
853  (when using a make based build system and not MSVC) in the 
854 \begin_inset Flex Code
855 status collapsed
856
857 \begin_layout Plain Layout
858 autotests
859 \end_layout
860
861 \end_inset
862
863  subfolder of the build directory.
864 \end_layout
865
866 \begin_layout Subsection
867 tex2lyx tests
868 \end_layout
869
870 \begin_layout Standard
871 The tex2lyx tests are located in the 
872 \begin_inset Flex Code
873 status collapsed
874
875 \begin_layout Plain Layout
876 src/tex2lyx/test
877 \end_layout
878
879 \end_inset
880
881  subfolder of the \SpecialChar LyX
882  source code distribution.
883  The actual testing is performed by the simple python script 
884 \begin_inset Flex Code
885 status collapsed
886
887 \begin_layout Plain Layout
888 src/tex2lyx/test/runtests.py
889 \end_layout
890
891 \end_inset
892
893 .
894  Each test consists of two files: 
895 \begin_inset Flex Code
896 status collapsed
897
898 \begin_layout Plain Layout
899 <test name>.tex
900 \end_layout
901
902 \end_inset
903
904  contains the \SpecialChar LaTeX
905  code that should be tested.
906  
907 \begin_inset Flex Code
908 status collapsed
909
910 \begin_layout Plain Layout
911 <test name>.lyx.lyx
912 \end_layout
913
914 \end_inset
915
916  contains the expected output of tex2lyx.
917  When a test is run, the actual produced output is compared with the stored
918  reference output.
919  The test passes if both are identical.
920  The test machinery is also able to generate a file 
921 \begin_inset Flex Code
922 status collapsed
923
924 \begin_layout Plain Layout
925 <test name>.lyx.tex
926 \end_layout
927
928 \end_inset
929
930  by exporting the produced .lyx file with \SpecialChar LyX
931  again.
932  This may be useful for roundtrip comparisons.
933 \end_layout
934
935 \begin_layout Subsubsection
936 Running the tests
937 \end_layout
938
939 \begin_layout Standard
940 The tex2lyx tests can be run in several ways.
941  When in the 
942 \begin_inset Flex Code
943 status collapsed
944
945 \begin_layout Plain Layout
946 src/tex2lyx
947 \end_layout
948
949 \end_inset
950
951  subfolder of the build directory, the commands 
952 \begin_inset Flex Code
953 status collapsed
954
955 \begin_layout Plain Layout
956 ctest
957 \end_layout
958
959 \end_inset
960
961  (cmake, all platforms), 
962 \begin_inset Flex Code
963 status collapsed
964
965 \begin_layout Plain Layout
966 make test
967 \end_layout
968
969 \end_inset
970
971  (cmake, when using a make based build system and not MSVC) or 
972 \begin_inset Flex Code
973 status collapsed
974
975 \begin_layout Plain Layout
976 make alltests
977 \end_layout
978
979 \end_inset
980
981  (autotools) will run the tex2lyx tests.
982  Alternatively, in the root of the build directory, the command 
983 \begin_inset Flex Code
984 status collapsed
985
986 \begin_layout Plain Layout
987 ctest -R tex2lyx
988 \end_layout
989
990 \end_inset
991
992  runs all tests whose names match the regex 
993 \begin_inset Quotes eld
994 \end_inset
995
996 tex2lyx
997 \begin_inset Quotes erd
998 \end_inset
999
1000 .
1001  Another way to run the tex2lyx tests in the root build directory is to
1002  instead use the command 
1003 \begin_inset Flex Code
1004 status collapsed
1005
1006 \begin_layout Plain Layout
1007 ctest -L '(cmplyx|roundtrip)'
1008 \end_layout
1009
1010 \end_inset
1011
1012 , which runs all tests categorized with the label 
1013 \begin_inset Quotes eld
1014 \end_inset
1015
1016 roundtrip
1017 \begin_inset Quotes erd
1018 \end_inset
1019
1020  or 
1021 \begin_inset Quotes eld
1022 \end_inset
1023
1024 cmplyx
1025 \begin_inset Quotes erd
1026 \end_inset
1027
1028 .
1029  If a test fails, the differences between the expected and actual results
1030  are output in unified diff format.
1031 \end_layout
1032
1033 \begin_layout Subsubsection
1034 Updating test references
1035 \begin_inset CommandInset label
1036 LatexCommand label
1037 name "sec:Updating-test-references"
1038
1039 \end_inset
1040
1041
1042 \end_layout
1043
1044 \begin_layout Standard
1045 In some cases a changed tex2lyx output is not a test failure, but wanted,
1046  e.
1047 \begin_inset space \thinspace{}
1048 \end_inset
1049
1050 g.
1051 \begin_inset space \space{}
1052 \end_inset
1053
1054 if a tex2lyx bug was fixed, or a new feature was added.
1055  In these cases the stored references need to be updated.
1056  To do so if using autotools, call 
1057 \begin_inset Flex Code
1058 status collapsed
1059
1060 \begin_layout Plain Layout
1061 make updatetests
1062 \end_layout
1063
1064 \end_inset
1065
1066  in the 
1067 \begin_inset Flex Code
1068 status collapsed
1069
1070 \begin_layout Plain Layout
1071 src/tex2lyx
1072 \end_layout
1073
1074 \end_inset
1075
1076  subdirectory of the build directory.
1077  If instead using CMake, call 
1078 \begin_inset Flex Code
1079 status collapsed
1080
1081 \begin_layout Plain Layout
1082 make updatetex2lyxtests
1083 \end_layout
1084
1085 \end_inset
1086
1087  in the build directory or in the 
1088 \begin_inset Flex Code
1089 status collapsed
1090
1091 \begin_layout Plain Layout
1092 src/tex2lyx/test
1093 \end_layout
1094
1095 \end_inset
1096
1097  subdirectory of the build directory.
1098 \begin_inset Foot
1099 status collapsed
1100
1101 \begin_layout Plain Layout
1102 Note that this is a case where a make target in the build directory can
1103  affect the source directory, which might not be advisable.
1104 \end_layout
1105
1106 \end_inset
1107
1108  On Windows do the following:
1109 \end_layout
1110
1111 \begin_layout Itemize
1112 Assure that the path to the python.exe is in your system PATH variable.
1113 \end_layout
1114
1115 \begin_layout Itemize
1116 Double-click on the file 
1117 \begin_inset Flex Code
1118 status collapsed
1119
1120 \begin_layout Plain Layout
1121 updatetex2lyxtests.vcxproj
1122 \end_layout
1123
1124 \end_inset
1125
1126  in the build directory or in the 
1127 \begin_inset Flex Code
1128 status collapsed
1129
1130 \begin_layout Plain Layout
1131 src/tex2lyx/test
1132 \end_layout
1133
1134 \end_inset
1135
1136  subdirectory of your build directory.
1137 \end_layout
1138
1139 \begin_layout Itemize
1140 In the appearing MSVC program right-click on the project 
1141 \family sans
1142 updatetex2lyxtests
1143 \family default
1144  in the project explorer and chose 
1145 \family sans
1146 Create
1147 \family default
1148 .
1149 \end_layout
1150
1151 \begin_layout Standard
1152 For convenience, these commands also produce re-exported roundtrip .lyx.tex
1153  files.
1154  Please examine the changed output carefully before committing the changed
1155  files to the repository: Since the test machinery does not do a roundtrip
1156  test .tex 
1157 \begin_inset Formula $\Rightarrow$
1158 \end_inset
1159
1160  .lyx 
1161 \begin_inset Formula $\Rightarrow$
1162 \end_inset
1163
1164  .tex, and does not compare the produced dvi or pdf output, it assumes that
1165  the stored .lyx reference produces correct output if processed by \SpecialChar LyX
1166 .
1167  There is only one chance to detect wrong output: before committing a new
1168  reference.
1169  Once it is committed, it is quite difficult to verify whether it is correct.
1170 \end_layout
1171
1172 \begin_layout Standard
1173 Please 
1174 \emph on
1175 do not
1176 \emph default
1177  update the test references by opening them with \SpecialChar LyX
1178  or directly running lyx2lyx
1179  on them.
1180  This would not work, since lyx2lyx and \SpecialChar LyX
1181  produce slightly different files
1182  regarding insignificant whitespace and line breaks.
1183 \end_layout
1184
1185 \begin_layout Subsubsection
1186 Adding a new test
1187 \end_layout
1188
1189 \begin_layout Standard
1190 In many cases tests for new features may be added to one of the existing
1191  test files, but sometimes this is not possible or not wanted.
1192  Then a new test file needs to be added:
1193 \end_layout
1194
1195 \begin_layout Enumerate
1196 Create the new file 
1197 \begin_inset Flex Code
1198 status collapsed
1199
1200 \begin_layout Plain Layout
1201 src/tex2lyx/test/<test name>.tex
1202 \end_layout
1203
1204 \end_inset
1205
1206  and run tex2lyx in roundtrip mode to produce the file 
1207 \begin_inset Flex Code
1208 status collapsed
1209
1210 \begin_layout Plain Layout
1211 src/tex2lyx/test/<test name>.lyx.lyx
1212 \end_layout
1213
1214 \end_inset
1215
1216 .
1217  This file will be the new reference.
1218 \end_layout
1219
1220 \begin_layout Enumerate
1221 Once you confirmed that the tex2lyx output is correct, add the new files
1222  to the corresponding lists in 
1223 \begin_inset Flex Code
1224 status collapsed
1225
1226 \begin_layout Plain Layout
1227 src/tex2lyx/test/runtests.py
1228 \end_layout
1229
1230 \end_inset
1231
1232
1233 \begin_inset Flex Code
1234 status collapsed
1235
1236 \begin_layout Plain Layout
1237 src/tex2lyx/Makefile.am
1238 \end_layout
1239
1240 \end_inset
1241
1242  and 
1243 \begin_inset Flex Code
1244 status collapsed
1245
1246 \begin_layout Plain Layout
1247 src/tex2lyx/test/CMakeLists.txt
1248 \end_layout
1249
1250 \end_inset
1251
1252 .
1253 \end_layout
1254
1255 \begin_layout Enumerate
1256 Commit the changes to the repository, or send a patch to the development
1257  list and ask for committing if you do not have commit rights.
1258 \end_layout
1259
1260 \begin_layout Subsection
1261 Export tests (cmake only)
1262 \end_layout
1263
1264 \begin_layout Standard
1265 The export tests are integration tests.
1266  They take longer to run and are more likely to break than the tex2lyx tests.
1267  Nevertheless, they have caught many regressions and without a better alternativ
1268 e it is important to keep them up-to-date and understand how they work.
1269 \end_layout
1270
1271 \begin_layout Standard
1272 The export tests require the 
1273 \begin_inset Flex Code
1274 status collapsed
1275
1276 \begin_layout Plain Layout
1277 ctest
1278 \end_layout
1279
1280 \end_inset
1281
1282  command that comes with the 
1283 \begin_inset Flex Code
1284 status collapsed
1285
1286 \begin_layout Plain Layout
1287 cmake
1288 \end_layout
1289
1290 \end_inset
1291
1292  build system
1293 \end_layout
1294
1295 \begin_layout Subsubsection
1296 Expectations of LyX developers
1297 \end_layout
1298
1299 \begin_layout Standard
1300 Because the export tests are integration tests and take a long time to run,
1301  LyX developers are rarely expected to run all of the tests.
1302  Here are some good practices to follow by developers:
1303 \end_layout
1304
1305 \begin_layout Itemize
1306 When making a non-trivial change to a .layout file, run the export and layout
1307  tests corresponding with that .layout file.
1308 \end_layout
1309
1310 \begin_layout Itemize
1311 When making non-trivial changes to a .lyx file, run the export tests correspondin
1312 g to that .lyx file.
1313 \end_layout
1314
1315 \begin_layout Itemize
1316 When making non-trivial changes to LyX's LaTeX export code (e.g.
1317  touching the encoding code or package handling code that you expect will
1318  change the exported LaTeX in some way), consider running all of the export
1319  tests before and after your change.
1320  If there are differences, please reconcile these (i.e.
1321  fix the bug or fix the tests) 
1322 \emph on
1323 before
1324 \emph default
1325  committing.
1326  Ask for help if you're not sure what to do or if you do not want to run
1327  the tests, post the patch on the list and others will run the tests.
1328 \end_layout
1329
1330 \begin_layout Itemize
1331 Understand how to interpret test failures.
1332  If your commit is found to have broken a test, you should be able to interpret
1333  the test results when made aware of them.
1334  See Section 
1335 \begin_inset CommandInset ref
1336 LatexCommand ref
1337 reference "subsec:Interpreting-export-tests"
1338
1339 \end_inset
1340
1341 .
1342 \end_layout
1343
1344 \begin_layout Subsubsection
1345 Configuring the tests
1346 \end_layout
1347
1348 \begin_layout Standard
1349 To enable these tests, add the 
1350 \begin_inset Flex Code
1351 status collapsed
1352
1353 \begin_layout Plain Layout
1354 -DLYX_ENABLE_EXPORT_TESTS=ON
1355 \end_layout
1356
1357 \end_inset
1358
1359  flag.
1360  For example:
1361 \end_layout
1362
1363 \begin_layout Standard
1364 \begin_inset Flex Code
1365 status collapsed
1366
1367 \begin_layout Plain Layout
1368 cmake -DLYX_ENABLE_EXPORT_TESTS=ON /path/to/source
1369 \end_layout
1370
1371 \end_inset
1372
1373
1374 \end_layout
1375
1376 \begin_layout Standard
1377 \noindent
1378 This flag will increase the time for the cmake command by several seconds,
1379  mainly because of the process of inverting tests (see Section 
1380 \begin_inset CommandInset ref
1381 LatexCommand ref
1382 reference "subsec:Interpreting-export-tests"
1383
1384 \end_inset
1385
1386 ).
1387 \end_layout
1388
1389 \begin_layout Subsubsection
1390 Running the tests
1391 \end_layout
1392
1393 \begin_layout Standard
1394 To run all tests, in the build directory simply run the command 
1395 \begin_inset Flex Code
1396 status collapsed
1397
1398 \begin_layout Plain Layout
1399 ctest
1400 \end_layout
1401
1402 \end_inset
1403
1404 .
1405  To run only some of the tests, use the command 
1406 \begin_inset Flex Code
1407 status collapsed
1408
1409 \begin_layout Plain Layout
1410 ctest -R <pattern>
1411 \end_layout
1412
1413 \end_inset
1414
1415 , where 
1416 \begin_inset Flex Code
1417 status collapsed
1418
1419 \begin_layout Plain Layout
1420 <pattern>
1421 \end_layout
1422
1423 \end_inset
1424
1425  is a regular expression that matches test names.
1426  To run only the export tests, you can use 
1427 \begin_inset Flex Code
1428 status collapsed
1429
1430 \begin_layout Plain Layout
1431 ctest -L export
1432 \end_layout
1433
1434 \end_inset
1435
1436 .
1437  For the list of test categories available in addition to 
1438 \begin_inset Quotes eld
1439 \end_inset
1440
1441 export
1442 \begin_inset Quotes erd
1443 \end_inset
1444
1445 , run 
1446 \begin_inset Flex Code
1447 status collapsed
1448
1449 \begin_layout Plain Layout
1450 ctest \SpecialChar nobreakdash
1451 \SpecialChar nobreakdash
1452 print-labels
1453 \end_layout
1454
1455 \end_inset
1456
1457 .
1458  It is often useful to list the tests without running them (e.g.
1459  if you want to know how many tests there are or whether your 
1460 \begin_inset Flex Code
1461 status collapsed
1462
1463 \begin_layout Plain Layout
1464 <pattern>
1465 \end_layout
1466
1467 \end_inset
1468
1469  regular expression did what you expected).
1470  This can be done with the 
1471 \begin_inset Flex Code
1472 status collapsed
1473
1474 \begin_layout Plain Layout
1475 -N
1476 \end_layout
1477
1478 \end_inset
1479
1480  or 
1481 \begin_inset Flex Code
1482 status collapsed
1483
1484 \begin_layout Plain Layout
1485 \SpecialChar nobreakdash
1486 \SpecialChar nobreakdash
1487 show-only
1488 \end_layout
1489
1490 \end_inset
1491
1492  argument.
1493  We are still working on getting the tests to run in parallel which is supported
1494  by the 
1495 \begin_inset Flex Code
1496 status collapsed
1497
1498 \begin_layout Plain Layout
1499 ctest
1500 \end_layout
1501
1502 \end_inset
1503
1504  command with the 
1505 \begin_inset Flex Code
1506 status collapsed
1507
1508 \begin_layout Plain Layout
1509 -j <jobs>
1510 \end_layout
1511
1512 \end_inset
1513
1514  or 
1515 \begin_inset Flex Code
1516 status collapsed
1517
1518 \begin_layout Plain Layout
1519 \SpecialChar nobreakdash
1520 \SpecialChar nobreakdash
1521 parallel <jobs>
1522 \end_layout
1523
1524 \end_inset
1525
1526  argument.
1527  However, when running the tests in parallel, sometimes tests fail that
1528  pass when run sequentially.
1529  A reasonable approach is to first run the tests in parallel and then run
1530  the failed tests sequentially.
1531  For example, to run 8 jobs at a time:
1532 \end_layout
1533
1534 \begin_layout Standard
1535 \begin_inset Flex Code
1536 status collapsed
1537
1538 \begin_layout Plain Layout
1539 ctest -j8
1540 \end_layout
1541
1542 \end_inset
1543
1544
1545 \end_layout
1546
1547 \begin_layout Standard
1548 \begin_inset Flex Code
1549 status collapsed
1550
1551 \begin_layout Plain Layout
1552 ctest \SpecialChar nobreakdash
1553 \SpecialChar nobreakdash
1554 rerun-failed
1555 \end_layout
1556
1557 \end_inset
1558
1559
1560 \end_layout
1561
1562 \begin_layout Standard
1563 \noindent
1564 Note that some tests cannot be run in parallel.
1565  These tests are marked in the code with the 
1566 \begin_inset Flex Code
1567 status collapsed
1568
1569 \begin_layout Plain Layout
1570 \noindent
1571 RUN_SERIAL ON
1572 \end_layout
1573
1574 \end_inset
1575
1576  CMake property.
1577 \end_layout
1578
1579 \begin_layout Standard
1580 In some situations the option 
1581 \begin_inset Flex Code
1582 status collapsed
1583
1584 \begin_layout Plain Layout
1585 \SpecialChar nobreakdash
1586 \SpecialChar nobreakdash
1587 timeout <seconds>
1588 \end_layout
1589
1590 \end_inset
1591
1592  is useful.
1593  There have been bugs in LyX and in LaTeX which cause compilation to hang,
1594  and without a timeout a test might never stop (in one case there was even
1595  a memory leak).
1596  If a test times out, the 
1597 \begin_inset Flex Code
1598 status collapsed
1599
1600 \begin_layout Plain Layout
1601 ctest
1602 \end_layout
1603
1604 \end_inset
1605
1606  command exits with error, but you can distinguish between a timed out test
1607  and a failed test in the output reported at the end of the 
1608 \begin_inset Flex Code
1609 status collapsed
1610
1611 \begin_layout Plain Layout
1612 ctest
1613 \end_layout
1614
1615 \end_inset
1616
1617  command.
1618 \end_layout
1619
1620 \begin_layout Standard
1621 See the manual (
1622 \begin_inset Flex Code
1623 status collapsed
1624
1625 \begin_layout Plain Layout
1626 man ctest
1627 \end_layout
1628
1629 \end_inset
1630
1631 ) the full list of command line options.
1632 \end_layout
1633
1634 \begin_layout Subsubsection
1635 \begin_inset CommandInset label
1636 LatexCommand label
1637 name "subsec:Interpreting-export-tests"
1638
1639 \end_inset
1640
1641 Interpreting the export test results
1642 \end_layout
1643
1644 \begin_layout Standard
1645 A test can fail for several reasons, not all of them bad.
1646 \end_layout
1647
1648 \begin_layout Enumerate
1649 The .lyx file could have been added recently and some formats are not expected
1650  to work well.
1651 \end_layout
1652
1653 \begin_layout Enumerate
1654 A dependency is not met (e.g.
1655  the LaTeX class file).
1656  One hint that this is the case is that the corresponding 
1657 \begin_inset Flex Code
1658 status open
1659
1660 \begin_layout Plain Layout
1661 check_load
1662 \end_layout
1663
1664 \end_inset
1665
1666  test will likely also fail.
1667 \end_layout
1668
1669 \begin_layout Enumerate
1670 An inverted test fails to fail (i.e.
1671  export that previously failed now works).
1672 \end_layout
1673
1674 \begin_layout Enumerate
1675 An external dependency was updated (e.g.
1676  TeX Live).
1677 \end_layout
1678
1679 \begin_layout Enumerate
1680 A recent code change introduced a bug.
1681 \end_layout
1682
1683 \begin_layout Enumerate
1684 \begin_inset CommandInset label
1685 LatexCommand label
1686 name "enu:exposed"
1687
1688 \end_inset
1689
1690 A change in a document exposed a previously unknown bug or an incompatibility
1691  with an export format (e.g.
1692  LuaTeX).
1693 \end_layout
1694
1695 \begin_layout Standard
1696 Because the .lyx files are exported in several formats, it is not surprising
1697  that many of the exports fail.
1698  This expectation of failure is addressed by 
1699 \begin_inset Quotes eld
1700 \end_inset
1701
1702 inverting
1703 \begin_inset Quotes erd
1704 \end_inset
1705
1706  the tests, that is, by marking the test as 
1707 \begin_inset Quotes eld
1708 \end_inset
1709
1710 passing
1711 \begin_inset Quotes erd
1712 \end_inset
1713
1714  if the export exits with error and as 
1715 \begin_inset Quotes eld
1716 \end_inset
1717
1718 failing
1719 \begin_inset Quotes erd
1720 \end_inset
1721
1722  if the export succeeds
1723 \emph on
1724 .
1725
1726 \emph default
1727  It follows that these expected failures will not show up as failed tests
1728  in the test results and thus will not pollute the 
1729 \begin_inset Quotes eld
1730 \end_inset
1731
1732 good
1733 \begin_inset Quotes erd
1734 \end_inset
1735
1736  tests.
1737  If the export actually succeeds, then the test will fail.
1738  The purpose of this failure is to get your attention—something has changed,
1739  possibly for the better.
1740 \end_layout
1741
1742 \begin_layout Standard
1743 We try to document why a test is inverted or ignored.
1744  See the comment (prefixed with 
1745 \begin_inset Flex Code
1746 status collapsed
1747
1748 \begin_layout Plain Layout
1749 #
1750 \end_layout
1751
1752 \end_inset
1753
1754 ) above the block in which the test is listed as inverted or ignored in
1755  the files 
1756 \begin_inset Flex Code
1757 status collapsed
1758
1759 \begin_layout Plain Layout
1760 development/autotests/revertedTests
1761 \end_layout
1762
1763 \end_inset
1764
1765  and 
1766 \begin_inset Flex Code
1767 status collapsed
1768
1769 \begin_layout Plain Layout
1770 development/autotests/ignoredTests
1771 \end_layout
1772
1773 \end_inset
1774
1775 .
1776  It is possible that an export goes from succeeding to failing just because
1777  the document was changed and the document was never expected to work with
1778  a certain export format in the first case.
1779  Once this is confirmed to be the situation, the test can be inverted.
1780 \end_layout
1781
1782 \begin_layout Standard
1783 A good question is why do we enable the tests for non-default formats? The
1784  answer is that if a non-default route is broken it is often because a bug
1785  was introduced in LyX and not because a document-specific change was made
1786  that is not supported by the route.
1787  In other words, there is a high signal/noise ratio in the export tests
1788  for some non-default formats.
1789  
1790 \end_layout
1791
1792 \begin_layout Standard
1793 What action should you take if a test fails? First, check manually that
1794  when the compilation succeeded before the resulting PDF was good.
1795  In fact, sometimes it is an improvement when a test fails.
1796  If you check manually, it might be the case that the export was succeeding
1797  before but showing garbled text in a PDF output.
1798  Now it might fail with a clear message of "language xyz not supported".
1799  It is always good to check manually why something fails and if it passes
1800  if the PDF output is good.
1801 \end_layout
1802
1803 \begin_layout Standard
1804 Sometimes a test is fixed as side-effect of some change.
1805  We should uninvert a test (remove it from the 
1806 \begin_inset Flex Code
1807 status collapsed
1808
1809 \begin_layout Plain Layout
1810 revertedTests
1811 \end_layout
1812
1813 \end_inset
1814
1815  file) in order to preserve the fix.
1816 \end_layout
1817
1818 \begin_layout Standard
1819 When a test or several tests fail, consider checking the files in the 
1820 \begin_inset Flex Code
1821 status collapsed
1822
1823 \begin_layout Plain Layout
1824 Testing/Temporary/
1825 \end_layout
1826
1827 \end_inset
1828
1829  subdirectory of your build directory.
1830  In this subdirectory are three files: the file 
1831 \begin_inset Flex Code
1832 status collapsed
1833
1834 \begin_layout Plain Layout
1835 LastTestsFailed.log
1836 \end_layout
1837
1838 \end_inset
1839
1840  simply lists the tests that failed on your last 
1841 \begin_inset Flex Code
1842 status collapsed
1843
1844 \begin_layout Plain Layout
1845 ctest
1846 \end_layout
1847
1848 \end_inset
1849
1850  command; the 
1851 \begin_inset Flex Code
1852 status collapsed
1853
1854 \begin_layout Plain Layout
1855 LastTest.log
1856 \end_layout
1857
1858 \end_inset
1859
1860  file contains the output from the tests (and often has details explaining
1861  why a test failed); and the 
1862 \begin_inset Flex Code
1863 status collapsed
1864
1865 \begin_layout Plain Layout
1866 CTestCostData.txt
1867 \end_layout
1868
1869 \end_inset
1870
1871  file lists the times that it took to run the tests.
1872 \end_layout
1873
1874 \begin_layout Subsubsection
1875 Inverted tests
1876 \end_layout
1877
1878 \begin_layout Standard
1879 These tests are expected to always fail.
1880 \end_layout
1881
1882 \begin_layout Description
1883 reverted These tests are expected to fail, but are subject to be examined.
1884  It is expected that they will pass in a foreseeable future.
1885  They are labeled 'reverted'.
1886 \end_layout
1887
1888 \begin_layout Description
1889 suspended Some inverted tests are labeled 'suspended'.
1890  This means, they are not executed using 
1891 \begin_inset Flex Code
1892 status collapsed
1893
1894 \begin_layout Plain Layout
1895 ctest -L export
1896 \end_layout
1897
1898 \end_inset
1899
1900  or 
1901 \begin_inset Flex Code
1902 status collapsed
1903
1904 \begin_layout Plain Layout
1905 ctest -L reverted
1906 \end_layout
1907
1908 \end_inset
1909
1910 .
1911  From time to time they still have to be checked using 
1912 \begin_inset Flex Code
1913 status collapsed
1914
1915 \begin_layout Plain Layout
1916 ctest -L suspended
1917 \end_layout
1918
1919 \end_inset
1920
1921 .
1922 \end_layout
1923
1924 \begin_deeper
1925 \begin_layout Standard
1926 These tests are suspended, because they fail for known reasons which cannot
1927  ATM be resolved.
1928  But it is expected the reason might disappear in the future.
1929  Be it new TL or better handling in \SpecialChar LyX
1930 .
1931 \end_layout
1932
1933 \begin_layout Standard
1934 For ctest commands without the 
1935 \begin_inset Flex Code
1936 status collapsed
1937
1938 \begin_layout Plain Layout
1939 -L
1940 \end_layout
1941
1942 \end_inset
1943
1944  parameter nothing changes.
1945  Suspended or not, tests will be executed depending only on the regexes
1946  parameters given to the ctest command.
1947 \end_layout
1948
1949 \end_deeper
1950 \begin_layout Subsubsection
1951 Unreliable tests
1952 \end_layout
1953
1954 \begin_layout Description
1955 nonstandard Requires non-standard ressources (LaTeX packages and document
1956  classes, fonts, ...) that are not a requirement for running this test suite.
1957 \end_layout
1958
1959 \begin_deeper
1960 \begin_layout Standard
1961 These tests are labeled as 
1962 \family typewriter
1963 'nonstandard'.
1964 \end_layout
1965
1966 \end_deeper
1967 \begin_layout Description
1968 erratic Tests with 
1969 \begin_inset Quotes eld
1970 \end_inset
1971
1972 arbitrary
1973 \begin_inset Quotes erd
1974 \end_inset
1975
1976  result, depending on local configuration, OS, TeX distribution, package
1977  versions, or the phase of the moon.
1978 \end_layout
1979
1980 \begin_deeper
1981 \begin_layout Standard
1982 These tests are labeled as 
1983 \family typewriter
1984 'erratic'.
1985 \end_layout
1986
1987 \end_deeper
1988 \begin_layout Subsection
1989 Export test filtering
1990 \end_layout
1991
1992 \begin_layout Standard
1993 There are files which control the assignment of a label to a test.
1994 \end_layout
1995
1996 \begin_layout Description
1997 ignoredTests (smal file)
1998 \begin_inset Newline newline
1999 \end_inset
2000
2001 Tests selected here are withdrawn
2002 \end_layout
2003
2004 \begin_deeper
2005 \begin_layout Labeling
2006 \labelwidthstring 00.00.0000
2007 Input Test of any export combination
2008 \end_layout
2009
2010 \begin_layout Labeling
2011 \labelwidthstring 00.00.0000
2012 Output Stop if tests not selected here
2013 \end_layout
2014
2015 \end_deeper
2016 \begin_layout Description
2017 unreliableTests: Tests selected either pass or fail, but that is dependent
2018  on the system where the test is run.
2019  Selected tests gain the label 'unreliable'.
2020 \end_layout
2021
2022 \begin_deeper
2023 \begin_layout Labeling
2024 \labelwidthstring 00.00.0000
2025 Input Each test which passed 'ignoredTests'
2026 \end_layout
2027
2028 \begin_layout Labeling
2029 \labelwidthstring 00.00.0000
2030 Output Stop if test selected, gain label 'unreliable'.
2031 \end_layout
2032
2033 \end_deeper
2034 \begin_layout Description
2035 suspiciousTests 
2036 \begin_inset space \space{}
2037 \end_inset
2038
2039
2040 \end_layout
2041
2042 \begin_deeper
2043 \begin_layout Labeling
2044 \labelwidthstring 00.00.0000
2045 Input Each test which passed 'unreliableTests'
2046 \end_layout
2047
2048 \begin_layout Labeling
2049 \labelwidthstring 00.00.0000
2050 Output Stop if not selected.
2051 \end_layout
2052
2053 \begin_layout Standard
2054 The following file is meant as subselections of 'suspiciousTests'.
2055  If neither subselection applies, test gains labels 'export' and 'reverted'
2056 \end_layout
2057
2058 \begin_layout Description
2059 suspendedTests Tests selected here gain the label 'suspended' but _not_
2060  'export' or 'reverted'.
2061 \end_layout
2062
2063 \begin_deeper
2064 \begin_layout Labeling
2065 \labelwidthstring 00.00.0000
2066 Input Each test selected by 'suspiciousTests' 
2067 \end_layout
2068
2069 \begin_layout Labeling
2070 \labelwidthstring 00.00.0000
2071 Output Selected test gains label 'suspended'.
2072  
2073 \end_layout
2074
2075 \end_deeper
2076 \end_deeper
2077 \begin_layout Subsection
2078 check_load tests
2079 \end_layout
2080
2081 \begin_layout Standard
2082 These tests check whether a .lyx file loads without any terminal messages.
2083  They correspond to the manual operations of simply opening a .lyx file on
2084  the terminal, exiting LyX once the file is loaded, and then checking whether
2085  there is any output from the terminal.
2086  These tests are useful for catching malformed .lyx files and parsing bugs.
2087  They can also be used to find a .lyx file in which an instance of something
2088  happens.
2089  To do this, compile LyX with a local patch that outputs something to the
2090  terminal when an instance is found, and then run the check_load tests to
2091  see if any fail, which would mean that the situation occurs in the LyX
2092  documentation files corresponding to the failed tests.
2093  These tests are expectedly fragile: any LyX diagnostic message, which is
2094  not necessarily an error, would cause the tests to fail.
2095  Similarly, any message output by a library (e.g.
2096  Qt) would also cause failure.
2097  There are some messages that the check_load tests are instructed to ignore,
2098  which are stored in the file 
2099 \begin_inset Flex Code
2100 status collapsed
2101
2102 \begin_layout Plain Layout
2103 development/autotests/filterCheckWarnings
2104 \end_layout
2105
2106 \end_inset
2107
2108 .
2109 \end_layout
2110
2111 \begin_layout Standard
2112 Under cmake, the tests are labeled as 'load'.
2113 \end_layout
2114
2115 \begin_layout Subsection
2116 URL tests (cmake only)
2117 \end_layout
2118
2119 \begin_layout Standard
2120 The URL tests are enabled with the 
2121 \begin_inset Flex Code
2122 status collapsed
2123
2124 \begin_layout Plain Layout
2125 -DLYX_ENABLE_URLTESTS=ON
2126 \end_layout
2127
2128 \end_inset
2129
2130  CMake flag and are useful for finding broken links in our documentation
2131  files.
2132  If a URL test fails, to see which link in particular was reported as broken,
2133  see the output in 
2134 \begin_inset Flex Code
2135 status collapsed
2136
2137 \begin_layout Plain Layout
2138 LastTest.log
2139 \end_layout
2140
2141 \end_inset
2142
2143 .
2144  These tests are extremely fragile (e.g.
2145  a test can depend on your Internet connection) and a failed URL test should
2146  not be taken too seriously.
2147  URL tests are labeled as 
2148 \family typewriter
2149 'url'.
2150 \end_layout
2151
2152 \begin_layout Subsubsection
2153 Running URL tests
2154 \end_layout
2155
2156 \begin_layout Standard
2157 cmake is required to run the \SpecialChar LyX
2158  tests, running them is not implemented for
2159  autotools.
2160 \end_layout
2161
2162 \begin_layout Standard
2163 The appropriate commands are:
2164 \end_layout
2165
2166 \begin_layout Itemize
2167
2168 \family typewriter
2169 ctest -L url
2170 \family default
2171
2172 \begin_inset Newline newline
2173 \end_inset
2174
2175 runns all tests with label 
2176 \family typewriter
2177 'url'
2178 \end_layout
2179
2180 \begin_layout Itemize
2181
2182 \family typewriter
2183 ctest -R 'check_.*urls'
2184 \family default
2185
2186 \begin_inset Newline newline
2187 \end_inset
2188
2189 runns the tests 'check_accessible_urls'
2190 \end_layout
2191
2192 \begin_layout Standard
2193 Associated test results can be examined in ctest-log directory in files
2194  of the form 'LastFailed.*URLS.log'
2195 \end_layout
2196
2197 \begin_layout Subsection
2198 Test labels (cmake only)
2199 \end_layout
2200
2201 \begin_layout Standard
2202 ctest label commands:
2203 \end_layout
2204
2205 \begin_layout Description
2206 \SpecialChar nobreakdash
2207 \SpecialChar nobreakdash
2208 print-labels shows all assigned labels
2209 \end_layout
2210
2211 \begin_layout Description
2212 \SpecialChar nobreakdash
2213 L
2214 \begin_inset space ~
2215 \end_inset
2216
2217 labelname executes all tests to which this label is asigned to.
2218  A test may have more that one label.
2219 \end_layout
2220
2221 \begin_layout Description
2222 \SpecialChar nobreakdash
2223 j
2224 \begin_inset space ~
2225 \end_inset
2226
2227 number executes tests in parallel using 'number' simultaneously processes.
2228  Some tests are marked as 'sequencial', for them this parameter has no effect.
2229 \end_layout
2230
2231 \begin_layout Section
2232 Development policies
2233 \end_layout
2234
2235 \begin_layout Standard
2236 This chapter lists some guidelines that should be followed.
2237  This list is not complete, and many guidelines are in separate chapters,
2238  such as 
2239 \begin_inset Quotes eld
2240 \end_inset
2241
2242 When is an update of the .lyx file format number needed?
2243 \begin_inset Quotes erd
2244 \end_inset
2245
2246  in Section 
2247 \begin_inset CommandInset ref
2248 LatexCommand ref
2249 reference "sec:When-is-an"
2250
2251 \end_inset
2252
2253 .
2254 \end_layout
2255
2256 \begin_layout Subsection
2257 When to set a fixed milestone?
2258 \end_layout
2259
2260 \begin_layout Standard
2261 Only set a fixed milestone (like 2.1.4 or 2.2.0) if at least one of the following
2262  holds:
2263 \end_layout
2264
2265 \begin_layout Enumerate
2266 Somebody is actively working on a fix.
2267 \end_layout
2268
2269 \begin_layout Enumerate
2270 The bug is so severe that it would block the release if it is not fixed.
2271 \end_layout
2272
2273 \begin_layout Standard
2274 If a bug is important, but nobody is working on it, and it is no showstopper,
2275  use a milestone like 2.1.x or 2.2.x.
2276  For all other bugs, do not set a milestone at all.
2277 \end_layout
2278
2279 \begin_layout Subsection
2280 Can we add rc entries in stable branch?
2281 \end_layout
2282
2283 \begin_layout Standard
2284 No.
2285  We are supposed to increase the prefs2prefs version number with such things.
2286 \end_layout
2287
2288 \begin_layout Section
2289 Documentation policies
2290 \end_layout
2291
2292 \begin_layout Standard
2293 The main documentation consists of these files:
2294 \end_layout
2295
2296 \begin_layout Description
2297 splash.lyx it is the first file you see after an installation.
2298  We assume that a new user sees this.
2299  It is therefore designed to be as simple as possible.
2300  Therefore please don't add any new formatting, only fix typos etc.
2301  Splash.lyx is up to date for \SpecialChar LyX
2302  2.1.x, currently maintained by Uwe Stöhr.
2303 \end_layout
2304
2305 \begin_layout Description
2306 Intro.lyx This is the manual new users will read to learn \SpecialChar LyX
2307 .
2308  It therefore uses a limited set of formatting.
2309  For example a standard document class.
2310  Since new users will first learn about the formatting possibilities of
2311  \SpecialChar LyX
2312  please keep this file that simple.
2313  Intro.lyx is up to date for \SpecialChar LyX
2314  2.1.x, currently maintained by Uwe Stöhr.
2315 \end_layout
2316
2317 \begin_layout Description
2318 Tutorial.lyx our tutorial.
2319  It must be always up to date.
2320  Normally there is nothing to add since we don't want to overwhelm new users
2321  with too much details.
2322  The will learn these details while using \SpecialChar LyX
2323  and we have special manuals.
2324  Tutorial.lyx is up to date for \SpecialChar LyX
2325  2.1.x, currently maintained by Uwe Stöhr.
2326 \end_layout
2327
2328 \begin_layout Description
2329 UserGuide.lyx our main user guide.
2330  It covers a mixture of basic and detailed information.
2331  Some information is also in the Math and EmbeddedObjects manual so that
2332  the UserGuide refers to these files.
2333  UserGuide.lyx is up to date for \SpecialChar LyX
2334  2.1.x, currently maintained by Uwe Stöhr.
2335 \end_layout
2336
2337 \begin_layout Description
2338 EmbeddedObjects.lyx a special manual to explain things like tables floats
2339  boxes etc.
2340  in all detail.
2341  EmbeddedObjects.lyx is up to date for \SpecialChar LyX
2342  2.1.x, currently maintained by Uwe
2343  Stöhr.
2344 \end_layout
2345
2346 \begin_layout Description
2347 Math.lyx a special manual to explain everything regarding math in all detail.
2348  Math.lyx is up to date for \SpecialChar LyX
2349  2.1.x, currently maintained by Uwe Stöhr.
2350 \end_layout
2351
2352 \begin_layout Description
2353 Additional.lyx this manual covers information that would be too much detail
2354  for the UserGuide or would make the UserGuide uncompilable or only compilable
2355  when installing a lot of special \SpecialChar LaTeX
2356 -packages.
2357  What should be in the UserGuide or better in Additional is a matter of
2358  taste.
2359  it is up to you to decide that.
2360  Additional.lyx is not completely up to date for \SpecialChar LyX
2361  2.1.x.
2362  Only chapter
2363 \begin_inset space ~
2364 \end_inset
2365
2366 8 is up to date and currently maintained by Uwe Stöhr.
2367  It certainly needs a rewrite and update.
2368  For example many info in chapter
2369 \begin_inset space ~
2370 \end_inset
2371
2372 2 and 3 are already covered by the UserGuide and/or the EmbeddedObjects
2373  manual.
2374 \end_layout
2375
2376 \begin_layout Description
2377 Customization.lyx this manual covers information how to customize \SpecialChar LyX
2378  for certain
2379  output formats, operating systems, languages etc.
2380  It is currently completely out of date and needs a major rewrite and update.
2381  If you do this please assure that your information are given for all OSes
2382  and \SpecialChar LaTeX
2383  distributions (meaning be as objective as possible).
2384 \end_layout
2385
2386 \begin_layout Standard
2387 There are only 4
2388 \begin_inset space ~
2389 \end_inset
2390
2391 rules in editing the docs:
2392 \end_layout
2393
2394 \begin_layout Enumerate
2395 If you are not the maintainer of a doc file or a chapter/section, you MUST
2396  use change tracking so that the maintainer could review your changes
2397 \end_layout
2398
2399 \begin_layout Enumerate
2400 Respect the formatting of the document.
2401  The different files use different formatting styles.
2402  That is OK and has historic reasons nobody fully know ;-).
2403  But it is important to be consistent within one file.
2404 \end_layout
2405
2406 \begin_layout Enumerate
2407 All changes you make to a file in one language MUST also go the file in
2408  the other actively maintained languages.
2409  Normally the maintainer does this for you, if you are the maintainer, you
2410  must do this by copying or changing the changed or added text to the other
2411  files so that the translators sees the blue underlined text and know what
2412  they have to translate and what was changed.
2413 \end_layout
2414
2415 \begin_layout Enumerate
2416 You MUST assure that the document is compilable as 
2417 \begin_inset Quotes eld
2418 \end_inset
2419
2420 PDF (pdflatex)
2421 \begin_inset Quotes erd
2422 \end_inset
2423
2424  after your changes.
2425 \end_layout
2426
2427 \end_body
2428 \end_document