[Libreoffice-commits] .: 10 commits - make-3.82-gbuild/doc make-3.82-gbuild/.gitignore make-3.82-gbuild/job.c make-3.82-gbuild/Makefile.am make-3.82-gbuild/Makefile.in make-3.82-gbuild/runbuiltin.c test-bugzilla-files/test-bugzilla-files.py
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Jan 9 17:59:24 PST 2013
make-3.82-gbuild/.gitignore | 4
make-3.82-gbuild/Makefile.am | 2
make-3.82-gbuild/Makefile.in | 7
make-3.82-gbuild/doc/make.info | 304 +++++++-------
make-3.82-gbuild/doc/make.info-1 | 8
make-3.82-gbuild/doc/make.info-2 | 4
make-3.82-gbuild/doc/stamp-vti | 4
make-3.82-gbuild/doc/version.texi | 4
make-3.82-gbuild/job.c | 11
make-3.82-gbuild/runbuiltin.c | 595 +++++++++++++++++++++++++++++
test-bugzilla-files/test-bugzilla-files.py | 372 ++++++++++++++++++
11 files changed, 1144 insertions(+), 171 deletions(-)
New commits:
commit f1fc0edaedd47dff795f061ad100d79cd5471386
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Wed Jan 9 19:47:46 2013 +0100
update autotools files
diff --git a/make-3.82-gbuild/Makefile.in b/make-3.82-gbuild/Makefile.in
index 9353ff5..0c5ecee 100644
--- a/make-3.82-gbuild/Makefile.in
+++ b/make-3.82-gbuild/Makefile.in
@@ -108,7 +108,7 @@ am__make_SOURCES_DIST = ar.c arscan.c commands.c default.c dir.c \
expand.c file.c function.c getopt.c getopt1.c implicit.c job.c \
main.c misc.c read.c remake.c remote-stub.c remote-cstms.c \
rule.c signame.c strcache.c variable.c version.c vpath.c \
- hash.c
+ hash.c runbuiltin.c
@USE_CUSTOMS_FALSE at am__objects_1 = remote-stub.$(OBJEXT)
@USE_CUSTOMS_TRUE at am__objects_1 = remote-cstms.$(OBJEXT)
am_make_OBJECTS = ar.$(OBJEXT) arscan.$(OBJEXT) commands.$(OBJEXT) \
@@ -118,7 +118,7 @@ am_make_OBJECTS = ar.$(OBJEXT) arscan.$(OBJEXT) commands.$(OBJEXT) \
main.$(OBJEXT) misc.$(OBJEXT) read.$(OBJEXT) remake.$(OBJEXT) \
$(am__objects_1) rule.$(OBJEXT) signame.$(OBJEXT) \
strcache.$(OBJEXT) variable.$(OBJEXT) version.$(OBJEXT) \
- vpath.$(OBJEXT) hash.$(OBJEXT)
+ vpath.$(OBJEXT) hash.$(OBJEXT) runbuiltin.$(OBJEXT)
make_OBJECTS = $(am_make_OBJECTS)
am__DEPENDENCIES_1 =
@WINDOWSENV_TRUE at am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
@@ -358,7 +358,7 @@ SUBDIRS = glob config po doc $(MAYBE_W32)
make_SOURCES = ar.c arscan.c commands.c default.c dir.c expand.c file.c \
function.c getopt.c getopt1.c implicit.c job.c main.c \
misc.c read.c remake.c $(remote) rule.c signame.c \
- strcache.c variable.c version.c vpath.c hash.c
+ strcache.c variable.c version.c vpath.c hash.c runbuiltin.c
EXTRA_make_SOURCES = vmsjobs.c remote-stub.c remote-cstms.c
noinst_HEADERS = commands.h dep.h filedef.h job.h make.h rule.h variable.h \
@@ -543,6 +543,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/remote-cstms.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/remote-stub.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rule.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/runbuiltin.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/signame.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/strcache.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/variable.Po at am__quote@
diff --git a/make-3.82-gbuild/doc/make.info b/make-3.82-gbuild/doc/make.info
index c83d722..697b3c2 100644
--- a/make-3.82-gbuild/doc/make.info
+++ b/make-3.82-gbuild/doc/make.info
@@ -4,8 +4,8 @@ This file documents the GNU `make' utility, which determines
automatically which pieces of a large program need to be recompiled,
and issues the commands to recompile them.
- This is Edition 0.71, last updated 17 September 2012, of `The GNU
-Make Manual', for GNU `make' version 3.82.
+ This is Edition 0.71, last updated 9 January 2013, of `The GNU Make
+Manual', for GNU `make' version 3.82.
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
@@ -30,158 +30,158 @@ END-INFO-DIR-ENTRY
Indirect:
-make.info-1: 1324
-make.info-2: 293666
+make.info-1: 1321
+make.info-2: 293660
Tag Table:
(Indirect)
-Node: Top1324
-Node: Overview14719
-Node: Preparing15729
-Node: Reading16700
-Node: Bugs17627
-Node: Introduction19456
-Node: Rule Introduction21047
-Node: Simple Makefile22980
-Node: How Make Works26676
-Node: Variables Simplify29331
-Node: make Deduces31537
-Node: Combine By Prerequisite33270
-Node: Cleanup34299
-Node: Makefiles35717
-Node: Makefile Contents36553
-Node: Makefile Names39659
-Node: Include41270
-Ref: Include-Footnote-145018
-Node: MAKEFILES Variable45152
-Node: Remaking Makefiles46693
-Node: Overriding Makefiles50917
-Node: Reading Makefiles52945
-Node: Secondary Expansion55957
-Node: Rules63398
-Node: Rule Example66070
-Node: Rule Syntax66924
-Node: Prerequisite Types69517
-Node: Wildcards72384
-Node: Wildcard Examples74102
-Node: Wildcard Pitfall75451
-Node: Wildcard Function77240
-Node: Directory Search79024
-Node: General Search80158
-Node: Selective Search81865
-Node: Search Algorithm84853
-Node: Recipes/Search87371
-Node: Implicit/Search88694
-Node: Libraries/Search89636
-Node: Phony Targets91606
-Node: Force Targets96675
-Node: Empty Targets97712
-Node: Special Targets99017
-Node: Multiple Targets106872
-Node: Multiple Rules108737
-Node: Static Pattern110955
-Node: Static Usage111607
-Node: Static versus Implicit115326
-Node: Double-Colon117067
-Node: Automatic Prerequisites118827
-Node: Recipes123105
-Node: Recipe Syntax124278
-Node: Splitting Lines126393
-Node: Variables in Recipes129493
-Node: Echoing130812
-Node: Execution132087
-Ref: Execution-Footnote-1133498
-Node: One Shell133643
-Node: Choosing the Shell136958
-Node: Parallel141104
-Node: Errors144825
-Node: Interrupts148493
-Node: Recursion150076
-Node: MAKE Variable152174
-Node: Variables/Recursion154421
-Node: Options/Recursion159871
-Node: -w Option165031
-Node: Canned Recipes166026
-Node: Empty Recipes169010
-Node: Using Variables170158
-Node: Reference173533
-Node: Flavors175091
-Node: Advanced180831
-Node: Substitution Refs181336
-Node: Computed Names182889
-Node: Values187435
-Node: Setting188352
-Node: Appending190388
-Node: Override Directive194314
-Node: Multi-Line195941
-Node: Undefine Directive198764
-Node: Environment199850
-Node: Target-specific202101
-Node: Pattern-specific205118
-Node: Suppressing Inheritance206964
-Node: Special Variables208418
-Node: Conditionals213131
-Node: Conditional Example213844
-Node: Conditional Syntax216407
-Node: Testing Flags222137
-Node: Functions223238
-Node: Syntax of Functions224669
-Node: Text Functions226868
-Node: File Name Functions235439
-Node: Conditional Functions240661
-Node: Foreach Function243035
-Node: Call Function246247
-Node: Value Function249132
-Node: Eval Function250569
-Node: Origin Function252845
-Node: Flavor Function256061
-Node: Shell Function257127
-Node: Make Control Functions258761
-Node: Running260423
-Node: Makefile Arguments262406
-Node: Goals263122
-Node: Instead of Execution267861
-Node: Avoiding Compilation271443
-Node: Overriding273417
-Node: Testing275720
-Node: Options Summary277604
-Node: Implicit Rules288002
-Node: Using Implicit290147
-Node: Catalogue of Rules293666
-Node: Implicit Variables303014
-Node: Chained Rules307771
-Node: Pattern Rules311782
-Node: Pattern Intro313317
-Node: Pattern Examples315905
-Node: Automatic Variables317711
-Node: Pattern Match325069
-Node: Match-Anything Rules328392
-Node: Canceling Rules332266
-Node: Last Resort332980
-Node: Suffix Rules334809
-Node: Implicit Rule Search338534
-Node: Archives342033
-Node: Archive Members342731
-Node: Archive Update344341
-Node: Archive Symbols346252
-Node: Archive Pitfalls347486
-Node: Archive Suffix Rules348208
-Node: Features349755
-Node: Missing358300
-Node: Makefile Conventions362027
-Node: Makefile Basics363006
-Node: Utilities in Makefiles366173
-Node: Command Variables368671
-Node: DESTDIR371910
-Node: Directory Variables374077
-Node: Standard Targets388692
-Ref: Standard Targets-Footnote-1402468
-Node: Install Command Categories402568
-Node: Quick Reference407094
-Node: Error Messages418777
-Node: Complex Makefile426473
-Node: GNU Free Documentation License434984
-Node: Concept Index460146
-Node: Name Index526643
+Node: Top1321
+Node: Overview14713
+Node: Preparing15723
+Node: Reading16694
+Node: Bugs17621
+Node: Introduction19450
+Node: Rule Introduction21041
+Node: Simple Makefile22974
+Node: How Make Works26670
+Node: Variables Simplify29325
+Node: make Deduces31531
+Node: Combine By Prerequisite33264
+Node: Cleanup34293
+Node: Makefiles35711
+Node: Makefile Contents36547
+Node: Makefile Names39653
+Node: Include41264
+Ref: Include-Footnote-145012
+Node: MAKEFILES Variable45146
+Node: Remaking Makefiles46687
+Node: Overriding Makefiles50911
+Node: Reading Makefiles52939
+Node: Secondary Expansion55951
+Node: Rules63392
+Node: Rule Example66064
+Node: Rule Syntax66918
+Node: Prerequisite Types69511
+Node: Wildcards72378
+Node: Wildcard Examples74096
+Node: Wildcard Pitfall75445
+Node: Wildcard Function77234
+Node: Directory Search79018
+Node: General Search80152
+Node: Selective Search81859
+Node: Search Algorithm84847
+Node: Recipes/Search87365
+Node: Implicit/Search88688
+Node: Libraries/Search89630
+Node: Phony Targets91600
+Node: Force Targets96669
+Node: Empty Targets97706
+Node: Special Targets99011
+Node: Multiple Targets106866
+Node: Multiple Rules108731
+Node: Static Pattern110949
+Node: Static Usage111601
+Node: Static versus Implicit115320
+Node: Double-Colon117061
+Node: Automatic Prerequisites118821
+Node: Recipes123099
+Node: Recipe Syntax124272
+Node: Splitting Lines126387
+Node: Variables in Recipes129487
+Node: Echoing130806
+Node: Execution132081
+Ref: Execution-Footnote-1133492
+Node: One Shell133637
+Node: Choosing the Shell136952
+Node: Parallel141098
+Node: Errors144819
+Node: Interrupts148487
+Node: Recursion150070
+Node: MAKE Variable152168
+Node: Variables/Recursion154415
+Node: Options/Recursion159865
+Node: -w Option165025
+Node: Canned Recipes166020
+Node: Empty Recipes169004
+Node: Using Variables170152
+Node: Reference173527
+Node: Flavors175085
+Node: Advanced180825
+Node: Substitution Refs181330
+Node: Computed Names182883
+Node: Values187429
+Node: Setting188346
+Node: Appending190382
+Node: Override Directive194308
+Node: Multi-Line195935
+Node: Undefine Directive198758
+Node: Environment199844
+Node: Target-specific202095
+Node: Pattern-specific205112
+Node: Suppressing Inheritance206958
+Node: Special Variables208412
+Node: Conditionals213125
+Node: Conditional Example213838
+Node: Conditional Syntax216401
+Node: Testing Flags222131
+Node: Functions223232
+Node: Syntax of Functions224663
+Node: Text Functions226862
+Node: File Name Functions235433
+Node: Conditional Functions240655
+Node: Foreach Function243029
+Node: Call Function246241
+Node: Value Function249126
+Node: Eval Function250563
+Node: Origin Function252839
+Node: Flavor Function256055
+Node: Shell Function257121
+Node: Make Control Functions258755
+Node: Running260417
+Node: Makefile Arguments262400
+Node: Goals263116
+Node: Instead of Execution267855
+Node: Avoiding Compilation271437
+Node: Overriding273411
+Node: Testing275714
+Node: Options Summary277598
+Node: Implicit Rules287996
+Node: Using Implicit290141
+Node: Catalogue of Rules293660
+Node: Implicit Variables303008
+Node: Chained Rules307765
+Node: Pattern Rules311776
+Node: Pattern Intro313311
+Node: Pattern Examples315899
+Node: Automatic Variables317705
+Node: Pattern Match325063
+Node: Match-Anything Rules328386
+Node: Canceling Rules332260
+Node: Last Resort332974
+Node: Suffix Rules334803
+Node: Implicit Rule Search338528
+Node: Archives342027
+Node: Archive Members342725
+Node: Archive Update344335
+Node: Archive Symbols346246
+Node: Archive Pitfalls347480
+Node: Archive Suffix Rules348202
+Node: Features349749
+Node: Missing358294
+Node: Makefile Conventions362021
+Node: Makefile Basics363000
+Node: Utilities in Makefiles366167
+Node: Command Variables368665
+Node: DESTDIR371904
+Node: Directory Variables374071
+Node: Standard Targets388686
+Ref: Standard Targets-Footnote-1402462
+Node: Install Command Categories402562
+Node: Quick Reference407088
+Node: Error Messages418771
+Node: Complex Makefile426467
+Node: GNU Free Documentation License434978
+Node: Concept Index460140
+Node: Name Index526637
End Tag Table
diff --git a/make-3.82-gbuild/doc/make.info-1 b/make-3.82-gbuild/doc/make.info-1
index c7cea15..c7d3512 100644
--- a/make-3.82-gbuild/doc/make.info-1
+++ b/make-3.82-gbuild/doc/make.info-1
@@ -4,8 +4,8 @@ This file documents the GNU `make' utility, which determines
automatically which pieces of a large program need to be recompiled,
and issues the commands to recompile them.
- This is Edition 0.71, last updated 17 September 2012, of `The GNU
-Make Manual', for GNU `make' version 3.82.
+ This is Edition 0.71, last updated 9 January 2013, of `The GNU Make
+Manual', for GNU `make' version 3.82.
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
@@ -38,8 +38,8 @@ This file documents the GNU `make' utility, which determines
automatically which pieces of a large program need to be recompiled,
and issues the commands to recompile them.
- This is Edition 0.71, last updated 17 September 2012, of `The GNU
-Make Manual', for GNU `make' version 3.82.
+ This is Edition 0.71, last updated 9 January 2013, of `The GNU Make
+Manual', for GNU `make' version 3.82.
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
diff --git a/make-3.82-gbuild/doc/make.info-2 b/make-3.82-gbuild/doc/make.info-2
index bebc789..2f367f3 100644
--- a/make-3.82-gbuild/doc/make.info-2
+++ b/make-3.82-gbuild/doc/make.info-2
@@ -4,8 +4,8 @@ This file documents the GNU `make' utility, which determines
automatically which pieces of a large program need to be recompiled,
and issues the commands to recompile them.
- This is Edition 0.71, last updated 17 September 2012, of `The GNU
-Make Manual', for GNU `make' version 3.82.
+ This is Edition 0.71, last updated 9 January 2013, of `The GNU Make
+Manual', for GNU `make' version 3.82.
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
diff --git a/make-3.82-gbuild/doc/stamp-vti b/make-3.82-gbuild/doc/stamp-vti
index cf43909..91b6973 100644
--- a/make-3.82-gbuild/doc/stamp-vti
+++ b/make-3.82-gbuild/doc/stamp-vti
@@ -1,4 +1,4 @@
- at set UPDATED 17 September 2012
- at set UPDATED-MONTH September 2012
+ at set UPDATED 9 January 2013
+ at set UPDATED-MONTH January 2013
@set EDITION 3.82
@set VERSION 3.82
diff --git a/make-3.82-gbuild/doc/version.texi b/make-3.82-gbuild/doc/version.texi
index cf43909..91b6973 100644
--- a/make-3.82-gbuild/doc/version.texi
+++ b/make-3.82-gbuild/doc/version.texi
@@ -1,4 +1,4 @@
- at set UPDATED 17 September 2012
- at set UPDATED-MONTH September 2012
+ at set UPDATED 9 January 2013
+ at set UPDATED-MONTH January 2013
@set EDITION 3.82
@set VERSION 3.82
commit 5252a195c1e4ab181b7dbc5f40550cf8a045ae69
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Wed Jan 9 19:47:34 2013 +0100
do not .gitignore files that are version controlled
diff --git a/make-3.82-gbuild/.gitignore b/make-3.82-gbuild/.gitignore
index 22becd0..57f479c 100644
--- a/make-3.82-gbuild/.gitignore
+++ b/make-3.82-gbuild/.gitignore
@@ -1,6 +1,5 @@
*.o
Makefile
-Makefile.in
.deps
build.sh
make
@@ -9,12 +8,9 @@ config.h
config.log
config.status
config/Makefile
-config/Makefile.in
po/Makefile
po/Makefile.in
po/POTFILES
doc/Makefile
-doc/Makefile.in
glob/.deps
-glob/Makefile.in
commit 7f93e23feb8f8c8b4cad7324880a26659e9c73cd
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Wed Jan 9 19:46:31 2013 +0100
builtins for some common LO shell commands
Since fork() is rather slow on Cygwin, this makes Windows builds
somewhat faster (especially things like delivering).
diff --git a/make-3.82-gbuild/Makefile.am b/make-3.82-gbuild/Makefile.am
index 92acdc2..d2759e9 100644
--- a/make-3.82-gbuild/Makefile.am
+++ b/make-3.82-gbuild/Makefile.am
@@ -43,7 +43,7 @@ endif
make_SOURCES = ar.c arscan.c commands.c default.c dir.c expand.c file.c \
function.c getopt.c getopt1.c implicit.c job.c main.c \
misc.c read.c remake.c $(remote) rule.c signame.c \
- strcache.c variable.c version.c vpath.c hash.c
+ strcache.c variable.c version.c vpath.c hash.c runbuiltin.c
EXTRA_make_SOURCES = vmsjobs.c remote-stub.c remote-cstms.c
diff --git a/make-3.82-gbuild/job.c b/make-3.82-gbuild/job.c
index aacfb84..3cd51fc 100644
--- a/make-3.82-gbuild/job.c
+++ b/make-3.82-gbuild/job.c
@@ -1139,12 +1139,14 @@ start_job_command (struct child *child)
return;
}
+ int ran_as_builtin = try_run_as_builtin( argv );
+
/* Print out the command. If silent, we call `message' with null so it
can log the working directory before the command's own error messages
appear. */
message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
- ? "%s" : (char *) 0, p);
+ ? "%s%s" : (char *) 0, ran_as_builtin ? "(Built-in) " : "", p);
/* Tell update_goal_chain that a command has been started on behalf of
this target. It is important that this happens here and not in
@@ -1155,6 +1157,13 @@ start_job_command (struct child *child)
++commands_started;
+ if( ran_as_builtin )
+ {
+ free (argv[0]);
+ free (argv);
+ goto next_command;
+ }
+
/* Optimize an empty command. People use this for timestamp rules,
so avoid forking a useless shell. Do this after we increment
commands_started so make still treats this special case as if it
diff --git a/make-3.82-gbuild/runbuiltin.c b/make-3.82-gbuild/runbuiltin.c
new file mode 100644
index 0000000..4e7af07
--- /dev/null
+++ b/make-3.82-gbuild/runbuiltin.c
@@ -0,0 +1,595 @@
+/* Running trivial commands as builtin in GNU Make.
+Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+2010 Free Software Foundation, Inc.
+This file is part of GNU Make.
+
+GNU Make is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3 of the License, or (at your option) any later
+version.
+
+GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "job.h"
+#include "make.h"
+
+#ifdef HAVE_DOS_PATHS
+/* TODO: For some reason WINDOWS32 is not set when building on Cygwin,
+ so enable the fast Windows builtins this way.
+*/
+#define MYWIN
+#else
+#define DISABLE /* don't bother otherwise */
+#endif
+
+#ifdef MYWIN
+#include <windows.h>
+#include <unistd.h>
+#endif
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+static int equals( const char* str1, const char* str2 )
+{
+ if( str1 == NULL || str2 == NULL )
+ return 0;
+ return strcmp( str1, str2 ) == 0;
+}
+
+/* Split a shell command into arguments.
+ Based on construct_command_argv_internal(), with #ifdef ORIGINAL_CODE
+ for modifications.
+*/
+static char** split_shell_args( char* line )
+{
+#ifndef ORIGINAL_CODE
+ /* Disable some code that's not needed here. */
+ const int unixy_shell = 0;
+ const int oneshell = 0;
+ char** restp = NULL;
+#endif
+
+ static char sh_chars_sh[] = "#;\"*?[]&|<>(){}$`^";
+ char** new_argv;
+ char* ap;
+ char* end;
+ char* argstr;
+ int i;
+ char *p;
+ int instring, word_has_equals, seen_nonequals, last_argument_was_empty;
+
+ /* Make sure not to bother processing an empty line. */
+ while (isblank ((unsigned char)*line))
+ ++line;
+ if (*line == '\0')
+ return 0;
+
+ i = strlen (line) + 1;
+
+ /* More than 1 arg per character is impossible. */
+ new_argv = xmalloc (i * sizeof (char *));
+
+#ifdef ORIGINAL_CODE
+ /* All the args can fit in a buffer as big as LINE is. */
+ ap = new_argv[0] = argstr = xmalloc (i);
+ end = ap + i;
+#else
+ /* They actually need a bigger buffer, because we do variable expansion. */
+ const int max_line_len = 64 * 1024;
+ ap = new_argv[0] = argstr = xmalloc( max_line_len );
+ end = ap + max_line_len;
+#endif
+
+ /* I is how many complete arguments have been found. */
+ i = 0;
+ instring = word_has_equals = seen_nonequals = last_argument_was_empty = 0;
+ for (p = line; *p != '\0'; ++p)
+ {
+ assert (ap <= end);
+
+ if (instring)
+ {
+ /* Inside a string, just copy any char except a closing quote
+ or a backslash-newline combination. */
+ if (*p == instring)
+ {
+ instring = 0;
+ if (ap == new_argv[0] || *(ap-1) == '\0')
+ last_argument_was_empty = 1;
+ }
+ else if (*p == '\\' && p[1] == '\n')
+ {
+ /* Backslash-newline is handled differently depending on what
+ kind of string we're in: inside single-quoted strings you
+ keep them; in double-quoted strings they disappear.
+ For DOS/Windows/OS2, if we don't have a POSIX shell,
+ we keep the pre-POSIX behavior of removing the
+ backslash-newline. */
+ if (instring == '"'
+#if defined (__MSDOS__) || defined (__EMX__) || defined (WINDOWS32)
+ || !unixy_shell
+#endif
+ )
+ ++p;
+ else
+ {
+ *(ap++) = *(p++);
+ *(ap++) = *p;
+ }
+ }
+ else if (*p == '\n' && restp != NULL)
+ {
+ /* End of the command line. */
+ *restp = p;
+ goto end_of_line;
+ }
+#ifdef ORIGINAL_CODE
+ /* Backslash, $, and ` are special inside double quotes.
+ If we see any of those, punt.
+ But on MSDOS, if we use COMMAND.COM, double and single
+ quotes have the same effect. */
+ else if (instring == '"' && strchr ("\\$`", *p) != 0 && unixy_shell)
+ goto slow;
+#endif
+ else
+ *ap++ = *p;
+ }
+#ifdef ORIGINAL_CODE
+ else if (strchr (sh_chars, *p) != 0)
+ /* Not inside a string, but it's a special char. */
+ goto slow;
+ else if (one_shell && *p == '\n')
+ /* In .ONESHELL mode \n is a separator like ; or && */
+ goto slow;
+#ifdef __MSDOS__
+ else if (*p == '.' && p[1] == '.' && p[2] == '.' && p[3] != '.')
+ /* `...' is a wildcard in DJGPP. */
+ goto slow;
+#endif
+#else /* ORIGINAL_CODE */
+ /* Expand variables from gb_Helper_abbreviate_dirs. They are one char long and
+ are used for paths. */
+ else if( *p == '$' && isalpha( p[ 1 ] ) && ( p[ 2 ] == '/' || p[ 2 ] == ' ' ))
+ {
+ int j;
+ for( j = 0;
+ j < i;
+ ++j )
+ {
+ if( new_argv[ j ][ 0 ] == p[ 1 ] && new_argv[ j ][ 1 ] == '=' )
+ { /* Found var definition, expand. */
+ ++p;
+ const char* from = new_argv[ j ] + 2;
+ while( *from != '\0' )
+ *ap++ = *from++;
+ break;
+ }
+ }
+ }
+#endif
+ else
+ /* Not a special char. */
+ switch (*p)
+ {
+ case '=':
+#ifdef ORIGINAL_CODE
+ /* Equals is a special character in leading words before the
+ first word with no equals sign in it. This is not the case
+ with sh -k, but we never get here when using nonstandard
+ shell flags. */
+ if (! seen_nonequals && unixy_shell)
+ goto slow;
+#endif
+ word_has_equals = 1;
+ *ap++ = '=';
+ break;
+ case '\\':
+ /* Backslash-newline has special case handling, ref POSIX.
+ We're in the fastpath, so emulate what the shell would do. */
+ if (p[1] == '\n')
+ {
+ /* Throw out the backslash and newline. */
+ ++p;
+
+ /* If there's nothing in this argument yet, skip any
+ whitespace before the start of the next word. */
+ if (ap == new_argv[i])
+ p = next_token (p + 1) - 1;
+ }
+ else if (p[1] != '\0')
+ {
+#ifdef HAVE_DOS_PATHS
+ /* Only remove backslashes before characters special to Unixy
+ shells. All other backslashes are copied verbatim, since
+ they are probably DOS-style directory separators. This
+ still leaves a small window for problems, but at least it
+ should work for the vast majority of naive users. */
+
+#ifdef __MSDOS__
+ /* A dot is only special as part of the "..."
+ wildcard. */
+ if (strneq (p + 1, ".\\.\\.", 5))
+ {
+ *ap++ = '.';
+ *ap++ = '.';
+ p += 4;
+ }
+ else
+#endif
+ if (p[1] != '\\' && p[1] != '\''
+ && !isspace ((unsigned char)p[1])
+ && strchr (sh_chars_sh, p[1]) == 0)
+ /* back up one notch, to copy the backslash */
+ --p;
+#endif /* HAVE_DOS_PATHS */
+
+ /* Copy and skip the following char. */
+ *ap++ = *++p;
+ }
+ break;
+
+ case '\'':
+ case '"':
+ instring = *p;
+ break;
+
+ case '\n':
+ if (restp != NULL)
+ {
+ /* End of the command line. */
+ *restp = p;
+ goto end_of_line;
+ }
+ else
+ /* Newlines are not special. */
+ *ap++ = '\n';
+ break;
+
+ case ' ':
+ case '\t':
+ /* We have the end of an argument.
+ Terminate the text of the argument. */
+ *ap++ = '\0';
+ new_argv[++i] = ap;
+ last_argument_was_empty = 0;
+
+#ifdef ORIGINAL_CODE
+ /* Update SEEN_NONEQUALS, which tells us if every word
+ heretofore has contained an `='. */
+ seen_nonequals |= ! word_has_equals;
+ if (word_has_equals && ! seen_nonequals)
+ /* An `=' in a word before the first
+ word without one is magical. */
+ goto slow;
+#endif
+ word_has_equals = 0; /* Prepare for the next word. */
+
+#ifdef ORIGINAL_CODE
+ /* If this argument is the command name,
+ see if it is a built-in shell command.
+ If so, have the shell handle it. */
+ if (i == 1)
+ {
+ register int j;
+ for (j = 0; sh_cmds[j] != 0; ++j)
+ {
+ if (streq (sh_cmds[j], new_argv[0]))
+ goto slow;
+# ifdef __EMX__
+ /* Non-Unix shells are case insensitive. */
+ if (!unixy_shell
+ && strcasecmp (sh_cmds[j], new_argv[0]) == 0)
+ goto slow;
+# endif
+ }
+ }
+#endif
+
+ /* Ignore multiple whitespace chars. */
+ p = next_token (p) - 1;
+ break;
+
+ default:
+ *ap++ = *p;
+ break;
+ }
+ }
+ end_of_line:
+
+ if (instring)
+ /* Let the shell deal with an unterminated quote. */
+#ifdef ORIGINAL_CODE
+ goto slow;
+#else
+ goto broken;
+#endif
+
+ /* Terminate the last argument and the argument list. */
+
+ *ap = '\0';
+ if (new_argv[i][0] != '\0' || last_argument_was_empty)
+ ++i;
+ new_argv[i] = 0;
+
+#ifdef ORIGINAL_CODE
+ if (i == 1)
+ {
+ register int j;
+ for (j = 0; sh_cmds[j] != 0; ++j)
+ if (streq (sh_cmds[j], new_argv[0]))
+ goto slow;
+ }
+#endif
+
+#ifndef ORIGINAL_CODE
+ /* Remove all variable definitions from the args, since they have been expanded,
+ and all commands that are builtin do not depend on them indirectly.*/
+ {
+ char* writepos = argstr;
+ int readpos;
+ int skipnext = 0;
+ int new_i = 0;
+ for( readpos = 0;
+ readpos < i;
+ ++readpos )
+ {
+ if( skipnext )
+ {
+ skipnext = 0;
+ if( new_argv[ readpos ][ 0 ] == '&' && new_argv[ readpos ][ 1 ] == '&'
+ && new_argv[ readpos ][ 2 ] == '\0' )
+ {
+ continue; /* skip the && following the variable definition */
+ }
+ }
+ if( isalpha( new_argv[ readpos ][ 0 ] ) && new_argv[ readpos ][ 1 ] == '=' )
+ skipnext = 1; /* skip this and possibly next */
+ else
+ {
+ const char* from = new_argv[ readpos ];
+ new_argv[ new_i ] = writepos;
+ while( *from != '\0' )
+ *writepos++ = *from++;
+ *writepos++ = '\0';
+ ++new_i;
+ }
+ }
+ i = new_i;
+ new_argv[ i ] = NULL;
+ }
+#endif
+ if (new_argv[0] == 0)
+ {
+ /* Line was empty. */
+ free (argstr);
+ free (new_argv);
+ return 0;
+ }
+
+ return new_argv;
+
+#ifndef ORIGINAL_CODE
+broken:
+ if (new_argv != 0)
+ {
+ /* Free the old argument list we were working on. */
+ free (argstr);
+ free (new_argv);
+ }
+ return NULL;
+#endif
+}
+
+/* Is normal cases ignore any backticks or expansions that we cannot handle
+ and let the real shell take care of it. */
+static int is_normal_argument( const char* item )
+{
+ return item != NULL && strchr( item, '`' ) == NULL && strchr( item, '$' ) == NULL;
+}
+
+static int touch_file( const char* file )
+{
+#ifdef MYWIN
+ int ok = 0;
+ HANDLE handle = CreateFile( file, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL, NULL );
+ if( handle != INVALID_HANDLE_VALUE )
+ {
+ FILETIME time;
+ GetSystemTimeAsFileTime( &time );
+ if( SetFileTime( handle, NULL, NULL, &time ))
+ ok = 1;
+ CloseHandle( handle );
+ }
+ return ok;
+#else
+ return 1;
+#endif
+}
+
+static int mkdir_p( const char* dir )
+{
+#ifdef MYWIN
+ return CreateDirectory( dir, NULL ) || GetLastError() == ERROR_ALREADY_EXISTS;
+#else
+ return 1;
+#endif
+}
+
+static int echo_to_file( const char* file, const char* txt, int append_nl )
+{
+#ifdef MYWIN
+ int ok = 0;
+ HANDLE handle = CreateFile( file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL, NULL );
+ if( handle != INVALID_HANDLE_VALUE )
+ {
+ DWORD written;
+ if( WriteFile( handle, txt, strlen( txt ), &written, NULL )
+ && written == strlen( txt )
+ && ( !append_nl
+ || ( WriteFile( handle, "\n", 1, &written, NULL )
+ && written == 1 )))
+ {
+ ok = 1;
+ }
+ CloseHandle( handle );
+ return ok;
+ }
+#else
+ return 1;
+#endif
+}
+
+int try_run_as_builtin( char** orig_argv )
+{
+#ifdef DISABLE
+ return 0;
+#endif
+ char** argv = orig_argv;
+ if( argv == NULL || argv[ 0 ] == NULL )
+ return 0;
+ int builtin = 0;
+
+/* fprintf( stderr, "C: \'%s\' \'%s\' \'%s\' \'%s\'\n", argv[ 0 ], argv[ 0 ] ? argv[ 1 ] : NULL,
+ argv[ 0 ] && argv[ 1 ] ? argv[ 2 ] : NULL, argv[ 0 ] && argv[ 1 ] && argv[ 2 ] ? argv[ 3 ] : NULL );
+*/
+ /* touch <file> */
+ if( equals( argv[ 0 ], "touch" )
+ && argv[ 1 ] != NULL
+ && argv[ 2 ] == NULL )
+ {
+ if( touch_file( argv[ 1 ] ))
+ builtin = 1;
+ }
+ /* mkdir -p <dir> */
+ else if( equals( argv[ 0 ], "mkdir" )
+ && equals( argv[ 1 ], "-p" )
+ && argv[ 2 ] != NULL
+ && argv[ 3 ] == NULL )
+ {
+ if( mkdir_p( argv[ 2 ] ))
+ builtin = 1;
+ }
+ /* cp [--remove-destination] --no-dereference --force --preserve=timestamps <srcfile> <destfile> */
+ else if( equals( argv[ 0 ], "/usr/bin/cp" ) || equals( argv[ 0 ], "/bin/cp" ) || equals( argv[ 0 ], "cp" ))
+ {
+ int remove = 0;
+ if( equals( argv[ 1 ], "--remove-destination" )) // may not be present
+ remove = 1;
+ if( equals( argv[ 1 + remove ], "--no-dereference" )
+ && equals( argv[ 2 + remove ], "--force" )
+ && equals( argv[ 3 + remove ], "--preserve=timestamps" )
+ && argv[ 4 + remove ] != NULL
+ && argv[ 5 + remove ] != NULL
+ && argv[ 6 + remove ] == NULL )
+ {
+#ifdef MYWIN
+ const char* srcfile = argv[ 4 + remove ];
+ const char* destfile = argv[ 5 + remove ];
+ struct stat st;
+ if( remove )
+ DeleteFile( destfile );
+ /* Do we ever actually copy symlinks this way? Handle --no-dereference.
+ Not sure if Windows can handle them, so use POSIX. */
+ if( lstat( srcfile, &st ) == 0 && S_ISLNK( st.st_mode ))
+ {
+ DeleteFile( destfile );
+ if( symlink( srcfile, destfile ) == 0 )
+ builtin = 1;
+ }
+ else
+ {
+ if( CopyFile( srcfile, destfile, 0 ))
+ builtin = 1;
+ }
+#else
+ builtin = 1;
+#endif
+ }
+ }
+ /* make has decided to run the command using shell */
+ else if( is_bourne_compatible_shell( argv[ 0 ] )
+ && equals( argv[ 1 ], "-c" )
+ && argv[ 2 ] != NULL && argv[ 2 ][ 0 ] != ' '
+ && argv[ 3 ] == NULL )
+ {
+ argv = split_shell_args( orig_argv[ 2 ] );
+/* fprintf( stderr, "SH \'%s\' \'%s\' \'%s\' \'%s\' \'%s\'\n", argv ? argv[ 0 ] : NULL,
+ argv && argv[ 0 ] ? argv[ 1 ] : NULL,
+ argv && argv[ 0 ] && argv[ 1 ] ? argv[ 2 ] : NULL,
+ argv && argv[ 0 ] && argv[ 1 ] && argv[ 2 ] ? argv[ 3 ] : NULL,
+ argv && argv[ 0 ] && argv[ 1 ] && argv[ 2 ] && argv[ 3 ] ? argv[ 4 ] : NULL );
+*/
+ if( argv == NULL )
+ ; /* possibly sh given empty command given, but let it process anyway, just in case */
+ /* mkdir -p <dir> && echo <txt> > <file> */
+ else if( equals( argv[ 0 ], "mkdir" )
+ && equals( argv[ 1 ], "-p" )
+ && is_normal_argument( argv[ 2 ] )
+ && equals( argv[ 3 ], "&&" )
+ && equals( argv[ 4 ], "echo" )
+ && argv[ 5 ] != NULL
+ && equals( argv[ 6 ], ">" )
+ && is_normal_argument( argv[ 7 ] )
+ && argv[ 8 ] == NULL )
+ {
+ if( mkdir_p( argv[ 2 ] ) && echo_to_file( argv[ 7 ], argv[ 5 ], 1 ))
+ builtin = 1;
+ }
+ /* mkdir -p <dir> && touch <file> */
+ else if( equals( argv[ 0 ], "mkdir" )
+ && equals( argv[ 1 ], "-p" )
+ && is_normal_argument( argv[ 2 ] )
+ && equals( argv[ 3 ], "&&" )
+ && equals( argv[ 4 ], "touch" )
+ && is_normal_argument( argv[ 5 ] )
+ && argv[ 6 ] == NULL )
+ {
+ if( mkdir_p( argv[ 2 ] ) && touch_file( argv[ 5 ] ))
+ builtin = 1;
+ }
+ /* mkdir -p `dirname <file>` && touch <file> */
+ else if( equals( argv[ 0 ], "mkdir" )
+ && equals( argv[ 1 ], "-p" )
+ && equals( argv[ 2 ], "`dirname" )
+ && argv[ 3 ][ strlen( argv[ 3 ] ) - 1 ] == '`'
+ && equals( argv[ 4 ], "&&" )
+ && equals( argv[ 5 ], "touch" )
+ && is_normal_argument( argv[ 6 ] )
+ && argv[ 7 ] == NULL )
+ {
+ // do the dirname first
+ char* dir = strdup( argv[ 3 ] );
+ dir[ strlen( dir ) - 1 ] = '\0'; // remove `
+ if( is_normal_argument( dir ) && *dir != '\0' )
+ {
+ char* pos = dir + strlen( dir ) - 1;
+ while( *pos != '/' && *pos != '\\' && pos > dir )
+ --pos;
+ if( pos > dir )
+ {
+ *pos = '\0';
+ if( mkdir_p( dir ) && touch_file( argv[ 6 ] ))
+ builtin = 1;
+ }
+ }
+ free( dir );
+ }
+ if( argv != NULL )
+ {
+ free( argv[ 0 ] );
+ free( argv );
+ }
+ argv = orig_argv;
+ }
+ return builtin;
+}
commit ab526a3287c97f1efdf07795f82df62e68be6049
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Dec 29 23:56:54 2012 +0100
we want to support a list of valid file extensions
diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py
index 5ac01ce..7bb7c24 100644
--- a/test-bugzilla-files/test-bugzilla-files.py
+++ b/test-bugzilla-files/test-bugzilla-files.py
@@ -322,9 +322,14 @@ class LoadFileTest:
if xDoc:
xDoc.close(True)
print("...done with: " + self.file)
+
+validFileExtensions = [ ".docx" , ".rtf", ".odt", ".doc" ]
-def runLoadFileTests(opts, dirs, suffix):
- files = getFiles(dirs, suffix)
+def runLoadFileTests(opts, dirs):
+ files = []
+ for suffix in validFileExtensions:
+ files.extend(getFiles(dirs, suffix))
+ files.sort()
crashed_files = []
tests = (LoadFileTest(file, crashed_files) for file in files)
connection = PersistentConnection(opts)
@@ -358,7 +363,7 @@ if __name__ == "__main__":
usage()
sys.exit()
elif "--soffice" in opts:
- runLoadFileTests(opts, args, ".docx")
+ runLoadFileTests(opts, args)
else:
usage()
sys.exit(1)
commit f8521a7118690ec9311a75894b07ca6c0416afa5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Dec 28 04:14:32 2012 +0100
store all the crashing files in one variable
diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py
index c03b0c3..5ac01ce 100644
--- a/test-bugzilla-files/test-bugzilla-files.py
+++ b/test-bugzilla-files/test-bugzilla-files.py
@@ -292,16 +292,18 @@ def loadFromURL(xContext, url):
if xListener:
xGEB.removeDocumentEventListener(xListener)
-def handleCrash(file):
+def handleCrash(file, crashed_files):
print("File: " + file + " crashed")
- crashLog = open("Writer crashlog.txt", "a")
+ crashLog = open("crashlog.txt", "a")
crashLog.write('Crash:' + file + '\n')
crashLog.close()
+ crashed_files.append(file)
# add here the remaining handling code for crashed files
class LoadFileTest:
- def __init__(self, file):
+ def __init__(self, file, crashed_files):
self.file = file
+ self.crashed_files = crashed_files
def run(self, xContext, connection):
print("Loading document: " + self.file)
try:
@@ -310,11 +312,11 @@ class LoadFileTest:
xDoc = loadFromURL(xContext, url)
except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"):
print("caught UnknownPropertyException " + self.file)
- handleCrash(self.file)
+ handleCrash(self.file, self.crashed_files)
connection.setUp()
except pyuno.getClass("com.sun.star.lang.DisposedException"):
print("caught DisposedException " + self.file)
- handleCrash(self.file)
+ handleCrash(self.file, self.crashed_files)
connection.setUp()
finally:
if xDoc:
@@ -323,10 +325,12 @@ class LoadFileTest:
def runLoadFileTests(opts, dirs, suffix):
files = getFiles(dirs, suffix)
- tests = (LoadFileTest(file) for file in files)
+ crashed_files = []
+ tests = (LoadFileTest(file, crashed_files) for file in files)
connection = PersistentConnection(opts)
# connection = PerTestConnection(opts)
runConnectionTests(connection, simpleInvoke, tests)
+ print(crashed_files)
def parseArgs(argv):
(optlist,args) = getopt.getopt(argv[1:], "hr",
@@ -354,7 +358,7 @@ if __name__ == "__main__":
usage()
sys.exit()
elif "--soffice" in opts:
- runLoadFileTests(opts, args, ".odt")
+ runLoadFileTests(opts, args, ".docx")
else:
usage()
sys.exit(1)
commit 70ee94d554cf9400beec9be39b6c3b6c673ad2a1
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Dec 28 04:14:05 2012 +0100
also cathc IllegalArgumentException
this exception means that the file can't be read
diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py
index 44a46bd..c03b0c3 100644
--- a/test-bugzilla-files/test-bugzilla-files.py
+++ b/test-bugzilla-files/test-bugzilla-files.py
@@ -281,6 +281,8 @@ def loadFromURL(xContext, url):
except pyuno.getClass("com.sun.star.lang.DisposedException"):
xListener = None
raise # means crashed, handle it later
+ except pyuno.getClass("com.sun.star.lang.IllegalArgumentException"):
+ pass # means could not open the file, ignore it
except:
if xDoc:
print("CLOSING")
commit a5e0f3bfe312094ee36ddb354d4cf3c7247af9b1
Author: jorendc <joren.libreoffice at telenet.be>
Date: Thu Dec 27 00:52:50 2012 +0100
add crashlog
diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py
index c0ab849..44a46bd 100644
--- a/test-bugzilla-files/test-bugzilla-files.py
+++ b/test-bugzilla-files/test-bugzilla-files.py
@@ -292,6 +292,9 @@ def loadFromURL(xContext, url):
def handleCrash(file):
print("File: " + file + " crashed")
+ crashLog = open("Writer crashlog.txt", "a")
+ crashLog.write('Crash:' + file + '\n')
+ crashLog.close()
# add here the remaining handling code for crashed files
class LoadFileTest:
@@ -345,7 +348,7 @@ if __name__ == "__main__":
if len(args) == 0:
usage()
sys.exit(1)
- if "-h" in opts or "--help" in opts: #
+ if "-h" in opts or "--help" in opts:
usage()
sys.exit()
elif "--soffice" in opts:
commit 753e330df61af85490c6fd8f4161852c126bf333
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Dec 26 16:50:53 2012 +0100
remove dutch comments
diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py
old mode 100755
new mode 100644
index 2ffbf90..c0ab849
--- a/test-bugzilla-files/test-bugzilla-files.py
+++ b/test-bugzilla-files/test-bugzilla-files.py
@@ -55,32 +55,32 @@ except ImportError:
### utilities ###
-def partition(list, pred): #defineer functie 'partition' met argumenten list en pred
- left = [] #nieuwe lijst left
- right = [] #nieuwe lijst rechts
- for e in list: #voor elke e in list
- if pred(e): #als
- left.append(e) #linkse kant toevoegen aan lijst links
+def partition(list, pred):
+ left = []
+ right = []
+ for e in list:
+ if pred(e):
+ left.append(e)
else:
- right.append(e) #rechtse kant toevoegen aan lijst rechts
- return (left, right) #geef linkse en rechtse lijst terug
+ right.append(e)
+ return (left, right)
-def filelist(dir, suffix): #defineer functie 'filelist' met argumenten dir en suffix
- if len(dir) == 0: #als de lengte van het argument dir gelijk is aan nul
- raise Exception("filelist: empty directory") #geef melding dat directory leeg is
- if not(dir[-1] == "/"): #als de directory niet met een / begint, een / voorzetten
+def filelist(dir, suffix):
+ if len(dir) == 0:
+ raise Exception("filelist: empty directory")
+ if not(dir[-1] == "/"):
dir += "/"
- files = [dir + f for f in os.listdir(dir)] #lijst files is dir + f voor elke f die in os.listdir(dir) is
+ files = [dir + f for f in os.listdir(dir)]
# print(files)
- return [f for f in files
+ return [f for f in files
if os.path.isfile(f) and os.path.splitext(f)[1] == suffix]
-def getFiles(dirs, suffix): #defineer functie 'getfiles' met argumenten dirs en suffix
+def getFiles(dirs, suffix):
print( dirs )
- files = [] #lege lijst
- for dir in dirs: #voor elke directory in dirs
- files += filelist(dir, suffix) #resultaat optellen bij files
- return files #files teruggeven
+ files = []
+ for dir in dirs:
+ files += filelist(dir, suffix)
+ return files
### UNO utilities ###
@@ -92,31 +92,31 @@ class OfficeConnection:
self.xContext = None
def setUp(self):
(method, sep, rest) = self.args["--soffice"].partition(":")
- if sep != ":": #als seperator niet gelijk is aan ":"
- raise Exception("soffice parameter does not specify method") #soffice parameter is nt gespecifieerd
- if method == "path": #als methode gelijk is aan path
+ if sep != ":":
+ raise Exception("soffice parameter does not specify method")
+ if method == "path":
socket = "pipe,name=pytest" + str(uuid.uuid1())
try:
- userdir = self.args["--userdir"] #probeer userdir
+ userdir = self.args["--userdir"]
except KeyError:
- raise Exception("'path' method requires --userdir") #userdir moet opgegeven worden
- if not(userdir.startswith("file://")): #als er geen URL wordt opgegeven
- raise Exception("--userdir must be file URL") #melding URL nodig
+ raise Exception("'path' method requires --userdir")
+ if not(userdir.startswith("file://")):
+ raise Exception("--userdir must be file URL")
self.soffice = self.bootstrap(rest, userdir, socket)
- elif method == "connect": #als methode connect is
- socket = rest #socket laten rusten
- else: # andere methoden worden niet
+ elif method == "connect":
+ socket = rest
+ else:
raise Exception("unsupported connection method: " + method)
self.xContext = self.connect(socket)
- def bootstrap(self, soffice, userdir, socket): #defineer fctie 'bootstrap' met soffice, userdir, socket
+ def bootstrap(self, soffice, userdir, socket):
argv = [ soffice, "--accept=" + socket + ";urp",
"-env:UserInstallation=" + userdir,
"--quickstart=no", "--nofirststartwizard",
- "--norestore", "--nologo", "--headless" ]
- if "--valgrind" in self.args: #als valgrind voorkomt in argS
- argv.append("--valgrind") #valgrid toevoegen aan argv
- return subprocess.Popen(argv) #waarde argv teruggeven 'Execute a child program in a new process.'
+ "--norestore", "--nologo", "--headless" ]
+ if "--valgrind" in self.args:
+ argv.append("--valgrind")
+ return subprocess.Popen(argv)
def connect(self, socket):
xLocalContext = uno.getComponentContext()
@@ -141,7 +141,7 @@ class OfficeConnection:
xMgr = self.xContext.ServiceManager
xDesktop = xMgr.createInstanceWithContext(
"com.sun.star.frame.Desktop", self.xContext)
- xDesktop.terminate() #afsluiten
+ xDesktop.terminate()
print("...done")
# except com.sun.star.lang.DisposedException:
except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"):
@@ -264,6 +264,7 @@ def loadFromURL(xContext, url):
try:
# we need to check if this method returns after loading or after invoking the loading
# depending on this we might need to put a timeout around it
+ xDoc = None
xDoc = xDesktop.loadComponentFromURL(url, "_blank", 0, loadProps)
time_ = 0
while time_ < 30:
@@ -328,7 +329,7 @@ def parseArgs(argv):
# print optlist
return (dict(optlist), args)
-def usage(): #te gebruiken tags
+def usage():
message = """usage: {program} [option]... [directory]..."
-h | --help: print usage information
--soffice=method:location
@@ -341,13 +342,13 @@ def usage(): #te gebruiken tags
if __name__ == "__main__":
(opts,args) = parseArgs(sys.argv)
- if len(args) == 0: #als lengte van args nul is -> afsluiten
- usage() #print de verschillende mogelijkheden
+ if len(args) == 0:
+ usage()
sys.exit(1)
if "-h" in opts or "--help" in opts: #
- usage() #print de verschillende mogelijkheden
- sys.exit() #als -h of --help wordt ingegeven -> ?
- elif "--soffice" in opts: #als --soffice in opts voorkomt
+ usage()
+ sys.exit()
+ elif "--soffice" in opts:
runLoadFileTests(opts, args, ".odt")
else:
usage()
commit 46ba637496b5b35818b8e869e3d8e8d3eaa0686d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Dec 26 03:04:54 2012 +0100
fix an error introduced by me before pushing
diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py
index fac6b8b..2ffbf90 100755
--- a/test-bugzilla-files/test-bugzilla-files.py
+++ b/test-bugzilla-files/test-bugzilla-files.py
@@ -264,7 +264,6 @@ def loadFromURL(xContext, url):
try:
# we need to check if this method returns after loading or after invoking the loading
# depending on this we might need to put a timeout around it
- xDoc = None
xDoc = xDesktop.loadComponentFromURL(url, "_blank", 0, loadProps)
time_ = 0
while time_ < 30:
@@ -276,8 +275,10 @@ def loadFromURL(xContext, url):
print("timeout: no OnLayoutFinished received")
return xDoc
except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"):
+ xListener = None
raise # means crashed, handle it later
except pyuno.getClass("com.sun.star.lang.DisposedException"):
+ xListener = None
raise # means crashed, handle it later
except:
if xDoc:
@@ -289,7 +290,7 @@ def loadFromURL(xContext, url):
xGEB.removeDocumentEventListener(xListener)
def handleCrash(file):
- print("File: " + file + " crahsed")
+ print("File: " + file + " crashed")
# add here the remaining handling code for crashed files
class LoadFileTest:
@@ -303,12 +304,12 @@ class LoadFileTest:
xDoc = loadFromURL(xContext, url)
except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"):
print("caught UnknownPropertyException " + self.file)
+ handleCrash(self.file)
connection.setUp()
- handleCrash(file)
except pyuno.getClass("com.sun.star.lang.DisposedException"):
print("caught DisposedException " + self.file)
+ handleCrash(self.file)
connection.setUp()
- handleCrash(file)
finally:
if xDoc:
xDoc.close(True)
commit 7f8476635e71def26ad614f00a263c95534f4723
Author: Joren De Cuyper <joren.de.cuyper at telenet.be>
Date: Wed Dec 26 01:46:07 2012 +0100
add first version for test-bugzilla-files script
diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py
new file mode 100755
index 0000000..fac6b8b
--- /dev/null
+++ b/test-bugzilla-files/test-bugzilla-files.py
@@ -0,0 +1,356 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# Major Contributor(s):
+# Copyright (C) 2012 Red Hat, Inc., Michael Stahl <mstahl at redhat.com>
+# (initial developer)
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+import getopt
+import os
+import subprocess
+import sys
+import time
+import uuid
+try:
+ from urllib.parse import quote
+except ImportError:
+ from urllib import quote
+
+try:
+ import pyuno
+ import uno
+ import unohelper
+except ImportError:
+ print("pyuno not found: try to set PYTHONPATH and URE_BOOTSTRAP variables")
+ print("PYTHONPATH=/installation/opt/program")
+ print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc")
+ raise
+
+try:
+ from com.sun.star.document import XDocumentEventListener
+except ImportError:
+ print("UNO API class not found: try to set URE_BOOTSTRAP variable")
+ print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc")
+ raise
+
+### utilities ###
+
+def partition(list, pred): #defineer functie 'partition' met argumenten list en pred
+ left = [] #nieuwe lijst left
+ right = [] #nieuwe lijst rechts
+ for e in list: #voor elke e in list
+ if pred(e): #als
+ left.append(e) #linkse kant toevoegen aan lijst links
+ else:
+ right.append(e) #rechtse kant toevoegen aan lijst rechts
+ return (left, right) #geef linkse en rechtse lijst terug
+
+def filelist(dir, suffix): #defineer functie 'filelist' met argumenten dir en suffix
+ if len(dir) == 0: #als de lengte van het argument dir gelijk is aan nul
+ raise Exception("filelist: empty directory") #geef melding dat directory leeg is
+ if not(dir[-1] == "/"): #als de directory niet met een / begint, een / voorzetten
+ dir += "/"
+ files = [dir + f for f in os.listdir(dir)] #lijst files is dir + f voor elke f die in os.listdir(dir) is
+# print(files)
+ return [f for f in files
+ if os.path.isfile(f) and os.path.splitext(f)[1] == suffix]
+
+def getFiles(dirs, suffix): #defineer functie 'getfiles' met argumenten dirs en suffix
+ print( dirs )
+ files = [] #lege lijst
+ for dir in dirs: #voor elke directory in dirs
+ files += filelist(dir, suffix) #resultaat optellen bij files
+ return files #files teruggeven
+
+### UNO utilities ###
+
+class OfficeConnection:
+ def __init__(self, args):
+ self.args = args
+ self.soffice = None
+ self.socket = None
+ self.xContext = None
+ def setUp(self):
+ (method, sep, rest) = self.args["--soffice"].partition(":")
+ if sep != ":": #als seperator niet gelijk is aan ":"
+ raise Exception("soffice parameter does not specify method") #soffice parameter is nt gespecifieerd
+ if method == "path": #als methode gelijk is aan path
+ socket = "pipe,name=pytest" + str(uuid.uuid1())
+ try:
+ userdir = self.args["--userdir"] #probeer userdir
+ except KeyError:
+ raise Exception("'path' method requires --userdir") #userdir moet opgegeven worden
+ if not(userdir.startswith("file://")): #als er geen URL wordt opgegeven
+ raise Exception("--userdir must be file URL") #melding URL nodig
+ self.soffice = self.bootstrap(rest, userdir, socket)
+ elif method == "connect": #als methode connect is
+ socket = rest #socket laten rusten
+ else: # andere methoden worden niet
+ raise Exception("unsupported connection method: " + method)
+ self.xContext = self.connect(socket)
+
+ def bootstrap(self, soffice, userdir, socket): #defineer fctie 'bootstrap' met soffice, userdir, socket
+ argv = [ soffice, "--accept=" + socket + ";urp",
+ "-env:UserInstallation=" + userdir,
+ "--quickstart=no", "--nofirststartwizard",
+ "--norestore", "--nologo", "--headless" ]
+ if "--valgrind" in self.args: #als valgrind voorkomt in argS
+ argv.append("--valgrind") #valgrid toevoegen aan argv
+ return subprocess.Popen(argv) #waarde argv teruggeven 'Execute a child program in a new process.'
+
+ def connect(self, socket):
+ xLocalContext = uno.getComponentContext()
+ xUnoResolver = xLocalContext.ServiceManager.createInstanceWithContext(
+ "com.sun.star.bridge.UnoUrlResolver", xLocalContext)
+ url = "uno:" + socket + ";urp;StarOffice.ComponentContext"
+ print("OfficeConnection: connecting to: " + url)
+ while True:
+ try:
+ xContext = xUnoResolver.resolve(url)
+ return xContext
+# except com.sun.star.connection.NoConnectException
+ except pyuno.getClass("com.sun.star.connection.NoConnectException"):
+ print("NoConnectException: sleeping...")
+ time.sleep(1)
+
+ def tearDown(self):
+ if self.soffice:
+ if self.xContext:
+ try:
+ print("tearDown: calling terminate()...")
+ xMgr = self.xContext.ServiceManager
+ xDesktop = xMgr.createInstanceWithContext(
+ "com.sun.star.frame.Desktop", self.xContext)
+ xDesktop.terminate() #afsluiten
+ print("...done")
+# except com.sun.star.lang.DisposedException:
+ except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"):
+ print("caught UnknownPropertyException")
+ print("crashed")
+ pass # ignore, also means disposed
+ except pyuno.getClass("com.sun.star.lang.DisposedException"):
+ print("caught DisposedException")
+ print("crashed")
+ pass # ignore
+ else:
+ self.soffice.terminate()
+ ret = self.soffice.wait()
+ self.xContext = None
+ self.socket = None
+ self.soffice = None
+ if ret != 0:
+ raise Exception("Exit status indicates failure: " + str(ret))
+# return ret
+
+class PerTestConnection:
+ def __init__(self, args):
+ self.args = args
+ self.connection = None
+ def getContext(self):
+ return self.connection.xContext
+ def setUp(self):
+ assert(not(self.connection))
+ def preTest(self):
+ conn = OfficeConnection(self.args)
+ conn.setUp()
+ self.connection = conn
+ def postTest(self):
+ if self.connection:
+ try:
+ self.connection.tearDown()
+ finally:
+ self.connection = None
+ def tearDown(self):
+ assert(not(self.connection))
+
+class PersistentConnection:
+ def __init__(self, args):
+ self.args = args
+ self.connection = None
+ def getContext(self):
+ return self.connection.xContext
+ def setUp(self):
+ conn = OfficeConnection(self.args)
+ conn.setUp()
+ self.connection = conn
+ def preTest(self):
+ assert(self.connection)
+ def postTest(self):
+ assert(self.connection)
+ def tearDown(self):
+ if self.connection:
+ try:
+ self.connection.tearDown()
+ finally:
+ self.connection = None
+
+def simpleInvoke(connection, test):
+ try:
+ connection.preTest()
+ test.run(connection.getContext(), connection)
+ finally:
+ connection.postTest()
+
+def retryInvoke(connection, test):
+ tries = 5
+ while tries > 0:
+ try:
+ tries -= 1
+ try:
+ connection.preTest()
+ test.run(connection.getContext(), connection)
+ return
+ finally:
+ connection.postTest()
+ except KeyboardInterrupt:
+ raise # Ctrl+C should work
+ except:
+ print("retryInvoke: caught exception")
+ raise Exception("FAILED retryInvoke")
+
+def runConnectionTests(connection, invoker, tests):
+ try:
+ connection.setUp()
+ for test in tests:
+ invoker(connection, test)
+ finally:
+ connection.tearDown()
+
+class EventListener(XDocumentEventListener,unohelper.Base):
+ def __init__(self):
+ self.layoutFinished = False
+ def documentEventOccured(self, event):
+# print(str(event.EventName))
+ if event.EventName == "OnLayoutFinished":
+ self.layoutFinished = True
+ def disposing(event):
+ pass
+
+def mkPropertyValue(name, value):
+ return uno.createUnoStruct("com.sun.star.beans.PropertyValue",
+ name, 0, value, 0)
+
+### tests ###
+
+def loadFromURL(xContext, url):
+ xDesktop = xContext.ServiceManager.createInstanceWithContext(
+ "com.sun.star.frame.Desktop", xContext)
+ props = [("Hidden", True), ("ReadOnly", True)] # FilterName?
+ loadProps = tuple([mkPropertyValue(name, value) for (name, value) in props])
+ xListener = EventListener()
+ xGEB = xContext.ServiceManager.createInstanceWithContext(
+ "com.sun.star.frame.GlobalEventBroadcaster", xContext)
+ xGEB.addDocumentEventListener(xListener)
+ try:
+# we need to check if this method returns after loading or after invoking the loading
+# depending on this we might need to put a timeout around it
+ xDoc = None
+ xDoc = xDesktop.loadComponentFromURL(url, "_blank", 0, loadProps)
+ time_ = 0
+ while time_ < 30:
+ if xListener.layoutFinished:
+ return xDoc
+ print("delaying...")
+ time_ += 1
+ time.sleep(1)
+ print("timeout: no OnLayoutFinished received")
+ return xDoc
+ except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"):
+ raise # means crashed, handle it later
+ except pyuno.getClass("com.sun.star.lang.DisposedException"):
+ raise # means crashed, handle it later
+ except:
+ if xDoc:
+ print("CLOSING")
+ xDoc.close(True)
+ raise
+ finally:
+ if xListener:
+ xGEB.removeDocumentEventListener(xListener)
+
+def handleCrash(file):
+ print("File: " + file + " crahsed")
+# add here the remaining handling code for crashed files
+
+class LoadFileTest:
+ def __init__(self, file):
+ self.file = file
+ def run(self, xContext, connection):
+ print("Loading document: " + self.file)
+ try:
+ url = "file://" + quote(self.file)
+ xDoc = None
+ xDoc = loadFromURL(xContext, url)
+ except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"):
+ print("caught UnknownPropertyException " + self.file)
+ connection.setUp()
+ handleCrash(file)
+ except pyuno.getClass("com.sun.star.lang.DisposedException"):
+ print("caught DisposedException " + self.file)
+ connection.setUp()
+ handleCrash(file)
+ finally:
+ if xDoc:
+ xDoc.close(True)
+ print("...done with: " + self.file)
+
+def runLoadFileTests(opts, dirs, suffix):
+ files = getFiles(dirs, suffix)
+ tests = (LoadFileTest(file) for file in files)
+ connection = PersistentConnection(opts)
+# connection = PerTestConnection(opts)
+ runConnectionTests(connection, simpleInvoke, tests)
+
+def parseArgs(argv):
+ (optlist,args) = getopt.getopt(argv[1:], "hr",
+ ["help", "soffice=", "userdir=", "valgrind"])
+# print optlist
+ return (dict(optlist), args)
+
+def usage(): #te gebruiken tags
+ message = """usage: {program} [option]... [directory]..."
+ -h | --help: print usage information
+ --soffice=method:location
+ specify soffice instance to connect to
+ supported methods: 'path', 'connect'
+ --userdir=URL specify user installation directory for 'path' method
+ --valgrind pass --valgrind to soffice for 'path' method"""
+ print(message.format(program = os.path.basename(sys.argv[0])))
+
+
+if __name__ == "__main__":
+ (opts,args) = parseArgs(sys.argv)
+ if len(args) == 0: #als lengte van args nul is -> afsluiten
+ usage() #print de verschillende mogelijkheden
+ sys.exit(1)
+ if "-h" in opts or "--help" in opts: #
+ usage() #print de verschillende mogelijkheden
+ sys.exit() #als -h of --help wordt ingegeven -> ?
+ elif "--soffice" in opts: #als --soffice in opts voorkomt
+ runLoadFileTests(opts, args, ".odt")
+ else:
+ usage()
+ sys.exit(1)
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab:
+
More information about the Libreoffice-commits
mailing list