Commit Graph

14 Commits

Author SHA1 Message Date
Vasily Galkin
50cb4f221c gspawn, tests: extend spawn_test, run it on win32
The spawn_test is enabled on win32 meson build, both msys and msvc.

Some modifications to make it useful for auto-testing on win32:
- use own argv0 to find helper win32-specific subprogram
- helper subprogram and conditions changed, so testing is fully
automated instead of manually checking contents of some MessageBoxes

Redirection test checks "sort" output for locale-independent string
instead of relying on "netstat" locale-dependent string.
Also with "sort" it become usable on unix, so enabled there too.
Currently this fails on win32 with coverage since
some coverage-realted error output from gpawn-win32-helper
is unexpectedly treated as executed subprocess output.


Added test checking "sort" with error-only redirection. This also fails
on win32 by now, due to a typo in gspawn-win32.c (checks for stdout
redirection instead of stderr)
2018-12-26 23:45:47 +03:00
Philip Withnall
5cddde1fb2 Consistently save errno immediately after the operation setting it
Prevent the situation where errno is set by function A, then function B
is called (which is typically _(), but could be anything else) and it
overwrites errno, then errno is checked by the caller.

errno is a horrific API, and we need to be careful to save its value as
soon as a function call (which might set it) returns. i.e. Follow the
pattern:
  int errsv, ret;
  ret = some_call_which_might_set_errno ();
  errsv = errno;

  if (ret < 0)
    puts (strerror (errsv));

This patch implements that pattern throughout GLib. There might be a few
places in the test code which still use errno directly. They should be
ported as necessary. It doesn’t modify all the call sites like this:
  if (some_call_which_might_set_errno () && errno == ESOMETHING)
since the refactoring involved is probably more harmful than beneficial
there. It does, however, refactor other call sites regardless of whether
they were originally buggy.

https://bugzilla.gnome.org/show_bug.cgi?id=785577
2017-08-03 10:21:13 +01:00
Sébastien Wilmet
f6c44ec3e4 tests/: LGPLv2+ -> LGPLv2.1+
gen-casefold-txt.pl and gen-casemap-txt.pl are licensed under GPLv2+, so
they are not touched by this commit.

A lot of *.c files in tests/ don't have a license header.

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:35 +02:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Tor Lillqvist
7d2ec70a49 Not needed, just use -DPCRE_STATIC.
2007-11-07  Tor Lillqvist  <tml@novell.com>

	* glib/update-pcre/notdll.patch: Not needed, just use -DPCRE_STATIC.

	* glib/update-pcre/Makefile.am: Drop notdll.patch.

	* glib/update-pcre/Makefile.am-1
	* glib/update-pcre/update.sh
	* glib/pcre/Makefile.am
	* glib/Makefile.am: Use -DPCRE_STATIC.

	* tests/gio-test.c
	* tests/mainloop-test.c
	* tests/spawn-test.c: #define pipe(fds) _pipe(fds, 4096,
	_O_BINARY) on Windows.

	* tests/regex-test.c (test_expand): Don't print NULL with %s.


svn path=/trunk/; revision=5805
2007-11-07 09:49:25 +00:00
Matthias Clasen
7221f500f5 Make the tests silent on success.
2005-07-14  Matthias Clasen  <mclasen@redhat.com>

	* tests/spawn-test.c:
	* tests/uri-test.c:
	* tests/thread-test.c:
	* tests/queue-test.c:
	* tests/mainloop-test.c:
	* tests/iochannel-test.c:
	* tests/gio-test.c:
	* tests/child-test.c: Make the tests silent on success.
2005-07-14 05:20:14 +00:00
Tor Lillqvist
20378332ae Print more detailled output from the timer tests. Don't print home
2005-03-20  Tor Lillqvist  <tml@novell.com>

	* tests/testglib.c (main): Print more detailled output from the
	timer tests. Don't print home directory twice. Test
	g_win32_error_message().

	* tests/spawn-test.c (run_tests): On Win32, run netstat instead of
	ipconfig. On Windows XP collecting output from ipconfig doesn't
	seem to work for some reason.
2005-03-20 10:43:38 +00:00
Tor Lillqvist
f4cb22c78d glib/gspawn-win32.c Implement G_SPAWN_FILE_AND_ARGV_ZERO. (#136792, Bruce
2004-03-10  Tor Lillqvist  <tml@iki.fi>

	* glib/gspawn-win32.c
	* glib/gspawn-win32-helper.c: Implement
	G_SPAWN_FILE_AND_ARGV_ZERO. (#136792, Bruce Hochstetler)

	* tests/spawn-test.c
	* tests/spawn-test-win32-gui.c: Test it.
2004-03-10 22:59:14 +00:00
Hans Breuer
2781d5f6b3 for msvc build
2003-07-20  Hans Breuer  <hans@breuer.org>

	* glib/trio/makefile.msc : (new file) for msvc build

	* glib/glib.def : removed some duplicated entries

	* glib/gscanner.c : add same workaround for MSVC(5.0)
	which does not allow to cast an uint64 to float.
	Same as in gvaluetransform.c
	Also move #include <io.h> behind inclusion of "glib.h"
	which defines the needed G_OS_WIN32

	* glib/makefile.msc.in : added gprintf.obj, trio\trio.lib
	as well as shell32.lib

	* tests/spawn-test.c : include <io.h> on win32
2003-07-20 15:55:09 +00:00
Tor Lillqvist
1f04f2cce2 Ignore the G_SPAWN_DO_NOT_REAP_CHILD flag, can't be meaninfully
2002-11-17  Tor Lillqvist  <tml@iki.fi>

	* glib/gspawn-win32.c (g_spawn_async_with_pipes): Ignore the
	G_SPAWN_DO_NOT_REAP_CHILD flag, can't be meaninfully implemented
	on Windows, at least not now. Always pass dont_wait as TRUE to
	do_spawn_with_pipes(). The semantics of the dont_wait parameter is
	very different from the semantics of the intermediate_child
	parameter to fork_exec_with_pipes() in the Unix version. This
	fixes a serious bug, g_spawn_async() in fact behaved
	synchronously.

	(do_spawn_with_pipes, do_spawn): Rename from
	fork_exec_with_pipes() and do_exec(), those names were from the
	Unix bersion, and misleading.

	(close_and_invalidate): Don't try to close invalid fds.

	* glib/gspawn.c (g_spawn_async_with_pipes): Add warning about
	Windows behaviour. There is no fork(), so the child_setup()
	function is in fact called in the parent.

	* glib/gspawn-win32-helper.c (WinMain): Insert spaces in argv
	debugging output.

	* tests/spawn-test-win32-gui.c: New file. Test program to be
	linked as a GUI application. Behaves differently depending on how
	invoked (by spawn-test).

	* tests/spawn-test.c (run_tests): On Win32, run the
	spawn-test-win32-gui program, too, in several ways, synchronously
	and asynchronously.

	* tests/Makefile.am: Corresponding change.
2002-11-17 03:52:55 +00:00
Tor Lillqvist
74b4d8c22e After being away for about five months, I'm back working on this... For
2001-08-30  Tor Lillqvist  <tml@iki.fi>

	After being away for about five months, I'm back working on
	this...  For now, still using same build setup for Win32. Probably
	will change to not including version numbers in the import library
	names, though. (But the DLL names would still include them,
	possibly even also the micro version number.) That would be more
	Unix-like. Also, will have to check out newest mingw tool versions
	to see if the build-dll script now can be retired.

	* makefile.mingw
	* makefile.msc: New files, no need to generate from .in as
	they don't contain references to automake variables.

	* makefile.mingw.in
	* makefile.msc.in: Removed.

	* glib.rc.in: Remove
	* glib/glib.rc.in: Moved here.

	* Makefile.am
	* glib/Makefile.am: Corresponding changes.

	* glib/glib.def: Fix typo, add new entries.

	* glib/gspawn-win32-helper.c: More debugging. Doesn't work
	currently (or then it never has on Win2k, which I now use?)

	* glib/gstrfuncs.c
	* glib/gstrfuncs.h: Mark g_ascii_table for export/import on Win32.

	* */makefile.mingw.in: Reflect new location of glib library.
2001-08-30 05:09:11 +00:00
Darin Adler
3fa620d4df Add missing const. (g_strsplit): Add g_return_val_if_fail for case of
* glib/gstrfuncs.c: (g_ascii_strdown), (g_ascii_strup): Add
	missing const.
	(g_strsplit): Add g_return_val_if_fail for case of empty
	delimiter, which can result in an infinite loop otherwise.
	* glib/gstrfuncs.h: Add missing const.
	* tests/.cvsignore: Ignore a generated file.

	* tests/array-test.c:
	* tests/dirname-test.c:
	* tests/hash-test.c:
	* tests/list-test.c:
	* tests/node-test.c:
	* tests/relation-test.c:
	* tests/shell-test.c:
	* tests/slist-test.c:
	* tests/spawn-test.c:
	* tests/strfunc-test.c:
	* tests/string-test.c:
	* tests/testglib.c:
	* tests/tree-test.c:
	* tests/type-test.c:
	Add an #undef G_DISABLE_ASSERT so all tests will assert even if
	asserts are disabled inside glib itself.
2001-07-19 20:07:41 +00:00
Tor Lillqvist
fb4de1c50d Some more debugging output. (g_io_channel_win32_poll): Remove unused vars.
2000-10-16  Tor Lillqvist  <tml@iki.fi>

	* giowin32.c (reader_thread): Some more debugging output.
	(g_io_channel_win32_poll): Remove unused vars.

	* gfileutils.c: Changes for Win32, with no unistd.h and no
	S_ISLNK().

	* gspawn-win32.c: Implementation of the g_spwan_* functions for
	Win32. Due to the general non-Unixness of Win32, much of the
	functionality that is relatively clean to implement on Unix, is
	hard to do on Win32. We must use a separate helper program to
	change directory, close extra file descriptors, redirect the std
	ones, as needed, and only then start the child process. No child
	process pid can be returned, unfortunately. Or if we used
	CreateProcess directly, it probably could. (Now we use the spawnv*
	functions from msvcrt.)

	* glib.def: Add new entry points.

	* glib.def
	* giowin32.c: Remove g_io_channel_win32_wait_for_condition(),
	g_io_channel_win32_poll() subsumes it.

	* gbacktrace.h: G_BREAKPOINT for MSVC (on the ix86).

	* gwin32.c (g_win32_getlocale): Use "sp" for
	LANG_CROATIAN+SUBLANG_SERBIAN_LATIN.

	* makefile.{mingw,msc}.in (glib_OBJECTS): Add new files.
	Add gspawn-win32-helper.exe rule.

	* tests/makefile.{mingw,msc}.in (TESTS): Add shell-test and
	spawn-test.

	* tests/spawn-test.c: (run_tests): On Win32, don't try to run
	/bin/sh, but ipconfig (no special significance in choosing that,
	just a program that outputs something to stdout).
2000-10-16 18:54:29 +00:00
Havoc Pennington
8e3a3eef63 Add new files.
2000-10-09  Havoc Pennington  <hp@redhat.com>

        * Makefile.am, tests/Makefile.am: Add new files.

	* tests/spawn-test.c, tests/shell-test.c: new tests for
	the shell/spawn stuff

	* gutils.c (g_find_program_in_path): convert a relative
	program name into an absolute pathname to an existing
	executable

	* gspawn.h, gspawn.c: New fork/exec API

	* gshell.h, gshell.c: Shell-related utilities, at the moment
	simply routines to parse argv and quote/unquote strings

	* guniprop.c (g_unichar_isspace): Return TRUE for the
	ASCII space characters isspace() returns TRUE for.

	* gfileutils.c (g_file_get_contents): Convenience function
	to slurp entire file into a string and return it. Partially
	written by Joel Becker.
	(g_file_test): file test function
2000-10-09 16:24:57 +00:00