Commit Graph
15 Commits
Author SHA1 Message Date
Rolf Bjarne Kvinge 632bb59b21 [System] Implement a helper function to create unique temporary directories and use it in tests. (#11831)
While working on PR #11829 I stress-tested the tests by running multiple test
runs in parallel, and it turned out that many tests were not parallel-safe,
because they used the same temporary file names and ended up stomping on
eachother.

So I implemented a helper method that creates a guaranteed unique temporary
directory, and I've changed all tests to use this new helper method.
2018-12-04 16:43:23 +01:00
Alexander Köplinger b683b3dc74 [System] Ignore FtpWebRequestTest.DownloadFile2_v6 test when IPv6 isn't available (#5695)
It fails on some systems otherwise. The other tests already had this check.
2017-10-04 11:51:48 +02:00
Alexander Köplinger 2a239b5205 [System] Add regression test for Bugzilla 10899 (#4401)
Even though I couldn't repro the bug I thought it'd still be a
good idea to at least add some basic coverage with non-Latin chars.
2017-02-27 23:43:56 +01:00
Alexander Köplinger d91796e39c [System] Add tests for IPv6-enabled FtpWebRequest 2016-10-12 18:43:47 +02:00
Rolf Bjarne Kvinge e6536dd5e1 [System*] Throw a PlatformNotSupported exception when using the networking stack on watchOS. (#3606)
* [System] Fix line endings for a few files.

Best reviewed by not showing whitespace changes (should be empty diff in that case).

* [System] Fix potential crash in CookieParserTests.

Socket.EndAccept can throw an exception, which will crash the process if it
happens on a threadpool. So handle any exceptions when calling
Socket.EndAccept, and propagate those exceptions out of any threadpool code.

* [System.Net.Http] Throw a PlatformNotSupported exception when using HttpClientHandler on watchOS.

* [System.Net.Http] Tweak tests after watchOS API change.

Unfortunately the [ExpectedException] attribute can't be put on an entire
class, so remove the [Category ("RequiresBSDSockets")] attribute on the class
and instead decorate each test with an [ExpectedException] attribute.

* [System] Extract the HttpListenerResponseHelper class to a separate file.

Extract the HttpListenerResponseHelper class to a separate file so that it's
easier to replace the HttpListenerResponse implementation by using a different
file.

* [System] Throw a PlatformNotSupported exception when using the networking stack on watchOS.

* [System] Tweak tests after watchOS API changes.

Unfortunately the [ExpectedException] attribute can't be put on an entire
class, so remove the [Category ("RequiresBSDSockets")] attribute on the class
and instead decorate each test with an [ExpectedException] attribute.

* [System] Fix potential crash in SocketAcceptAsyncTest.

Fix potential crash in SocketAcceptAsyncTest by catching any exceptions in
code executed on the threadpool so that we never end up with unhandled
exceptions (which may terminate the process).

* [System] Avoid logic in SetUp attributes in tests.

Any type of exception in [SetUp] attributes causes all tests to fail with that
exception.

This even happens for tests that do not need the logic in the [SetUp]
attribute.

So rewrite tests a bit to not use [SetUp] when we can reasonably avoid it, and
instead instantiate class-level variables on first use. This ensures that any
exceptions that occur when initializing those variables are attributed to the
corresponding test, and not all of them.

* [System] Make exception handler (for test) catch more exceptions to avoid unhandled exceptions causing process termination.

* [System] Remove Obsolete attribute on API that throws PNSE.
2016-09-27 13:13:38 +02:00
Rolf Bjarne Kvinge 51de6e83eb [System*] Add category for tests that use API that require BSD sockets.
We don't have access to BSD sockets on watchOS, so that API
doesn't work.

With this category we'll be able to exclude these tests.
2016-07-26 13:20:51 +02:00
Miguel de Icaza 27da886fe8 [FtpWebRequest] Add test for bug #26312, issue was fixed by bringing .NET's implementation 2015-01-29 10:45:59 -05:00
Alexander Köplinger 746650d1b9 [bcl] Remove more NET_2_0 checks from class libs 2015-01-17 05:45:39 +01:00
Jonathan Pryor f9d78260db [System] Support FTP download where PWD starts with '\'.
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=13343

There are some Industrial Automation Hardware devices which return a
'\'-prefixed path to the FTP PWD command, which would break:

	System.UriFormatException: Invalid URI: The hostname could not be parsed.
	  at System.Uri.Parse (UriKind kind, System.String uriString)
	  at System.Uri.ParseUri (UriKind kind)
	  at System.Uri..ctor (System.String uriString, Boolean dontEscape)
	  at System.Uri..ctor (System.String uriString) [0x0000
	  at System.Net.FtpWebRequest.GetRemoteFolderPath (System.Uri uri)
	  at System.Net.FtpWebRequest.CWDAndSetFileName (System.Uri uri)
	  at System.Net.FtpWebRequest.ProcessMethod ()
	  at System.Net.FtpWebRequest.ProcessRequest ()
	There was an error connecting to the FTP Server.

The problem was this statement:

	Uri initial = new Uri ("ftp://dummy-host" + initial_path);

Since the FTP server was returning "\" to the PWD command,
`initial_path` was "\", and the above was equivalent to:

	Uri initial = new Uri (@"ftp://dummy-host\");

This results in the UriFormatException.

The solution is to not assume that `initial_path` will start with '/',
and instead use UriBuilder.
2013-07-25 11:38:09 -04:00
Gonzalo Paniagua Javier 4181e28735 2009-01-16 Gonzalo Paniagua Javier <[email protected]>
* FtpWebRequestTest.cs: add directory listing test when the $HOME is
	not /.


svn path=/trunk/mcs/; revision=123616
2009-01-16 15:40:23 +00:00
Gonzalo Paniagua Javier b5ac5d886d 2009-01-12 Gonzalo Paniagua Javier <[email protected]>
* FtpWebRequestTest.cs: test deleting a file.


svn path=/trunk/mcs/; revision=123136
2009-01-12 22:03:32 +00:00
Gonzalo Paniagua Javier 96679ba6ec 2008-11-13 Gonzalo Paniagua Javier <[email protected]>
* FtpWebRequestTest.cs: the upload test now passes with the MS
	runtime. Added another test for download.


svn path=/trunk/mcs/; revision=118784
2008-11-13 22:56:58 +00:00
Gonzalo Paniagua Javier 8f1e89a022 2008-11-03 Gonzalo Paniagua Javier <[email protected]>
* FtpWebRequestTest.cs: add test for bug 333985.


svn path=/trunk/mcs/; revision=117839
2008-11-04 03:05:45 +00:00
Carlos Alberto Cortez 34dfa0d660 2006-02-03 Carlos Alberto Cortez <[email protected]>
* FtpWebRequestTest.cs: Add a small check for Method.
	

svn path=/trunk/mcs/; revision=56558
2006-02-04 02:42:05 +00:00
Carlos Alberto Cortez 2a026bcef6 2006-02-03 Carlos Alberto Cortez <[email protected]>
* FtpWebRequestTest.cs: New file to test properties/methods
	that don't need any connection to work.
	

svn path=/trunk/mcs/; revision=56515
2006-02-03 10:19:06 +00:00