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