endif
# System.IO/DirectoryInfoTest.cs needs Mono.Posix
-TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe $(CORLIB_MONO_POSIX_REF) -r:System.Core.dll \
+TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe $(CORLIB_MONO_POSIX_REF) -r:System.Core.dll -r:System.dll \
-define:MONO_DATACONVERTER_STATIC_METHODS $(TEST_RESX_RESOURCES:%=-resource:%)
EXTRA_DISTFILES = \
using System.Reflection;
using System.Threading;
+#if !MOBILE
+using System.Diagnostics;
+#endif
+
using NUnit.Framework;
namespace MonoTests.System
}
}
+ // Several tests in this file, to run properly, allocate 4GB objects.
+ // Obviously this creates problems on several kinds of systems, so we
+ // conservatively skip these tests unless we find a high-RAM environment.
+ // Checking RAM requires PerformanceCounter which is absent on mobile,
+ // so any test that calls this must be category MobileNotWorking.
+ static void RequireHighMemoryTestEnvironment ()
+ {
+#if MOBILE
+ Assert.Ignore("PerformanceCounter not available.")
+#else
+ if (!Environment.Is64BitProcess)
+ Assert.Ignore("This test cannot run on a 32-bit system.");
+
+ // Require 6 GB physical RAM, for the 4GB string plus 2GB headroom
+ var pc = new PerformanceCounter ("Mono Memory", "Total Physical Memory");
+
+ if (pc.RawValue < 6L*1024L*1024L*1024L)
+ Assert.Ignore("This machine may not have enough RAM to run this test.");
+#endif
+ }
+
[Test] // ctor (Char, Int32)
+ [Category ("MobileNotWorking")]
public void Constructor4_LargeString ()
{
- try {
- var x = new String ('A', int.MaxValue);
- if (Environment.Is64BitProcess) {
- Assert.AreEqual ('A', x[0]);
- Assert.AreEqual ('A', x[int.MaxValue - 1]);
- }
- else
- Assert.Fail ("Expected OutOfMemoryException.");
- } catch (OutOfMemoryException) {
- }
+ RequireHighMemoryTestEnvironment();
+
+ var x = new String ('A', int.MaxValue);
+ Assert.AreEqual ('A', x[0]);
+ Assert.AreEqual ('A', x[int.MaxValue - 1]);
}
[Test] // ctor (Char [], Int32, Int32)
}
[Test]
+ [Category ("MobileNotWorking")]
public void PadLeft_LargeString ()
{
- try {
- var x = "x".PadLeft (int.MaxValue, '-');
- if (Environment.Is64BitProcess) {
- Assert.AreEqual ('-', x[0]);
- Assert.AreEqual ('x', x[int.MaxValue - 1]);
- }
- else
- Assert.Fail ("Expected OutOfMemoryException.");
- } catch (OutOfMemoryException) {
- }
+ RequireHighMemoryTestEnvironment();
+
+ var x = "x".PadLeft (int.MaxValue, '-');
+ Assert.AreEqual ('-', x[0]);
+ Assert.AreEqual ('x', x[int.MaxValue - 1]);
}
[Test] // PadRight (Int32)
}
[Test]
+ [Category ("MobileNotWorking")]
public void PadRight_LargeString ()
{
- try {
- var x = "x".PadRight (int.MaxValue, '-');
- if (Environment.Is64BitProcess) {
- Assert.AreEqual ('x', x[0]);
- Assert.AreEqual ('-', x[int.MaxValue - 1]);
- }
- else
- Assert.Fail ("Expected OutOfMemoryException.");
- } catch (OutOfMemoryException) {
- }
+ RequireHighMemoryTestEnvironment();
+
+ var x = "x".PadRight (int.MaxValue, '-');
+ Assert.AreEqual ('x', x[0]);
+ Assert.AreEqual ('-', x[int.MaxValue - 1]);
}
[Test] // Remove (Int32, Int32)
ICALL(MATH_18, "Tanh", ves_icall_System_Math_Tanh)
ICALL_TYPE(MCATTR, "System.MonoCustomAttrs", MCATTR_1)
-ICALL(MCATTR_1, "GetCustomAttributesDataInternal", mono_reflection_get_custom_attrs_data)
+ICALL(MCATTR_1, "GetCustomAttributesDataInternal", ves_icall_MonoCustomAttrs_GetCustomAttributesDataInternal)
ICALL(MCATTR_2, "GetCustomAttributesInternal", custom_attrs_get_by_type)
ICALL(MCATTR_3, "IsDefinedInternal", custom_attrs_defined_internal)
}
}
+ICALL_EXPORT MonoArray*
+ves_icall_MonoCustomAttrs_GetCustomAttributesDataInternal (MonoObject *obj)
+{
+ MonoError error;
+ MonoArray *result;
+ result = mono_reflection_get_custom_attrs_data_checked (obj, &error);
+ mono_error_set_pending_exception (&error);
+ return result;
+}
+
+
ICALL_EXPORT MonoString*
ves_icall_Mono_Runtime_GetDisplayName (void)
{
MonoObject*
mono_custom_attrs_get_attr_checked (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass, MonoError *error);
+MonoArray*
+mono_reflection_get_custom_attrs_data_checked (MonoObject *obj, MonoError *error);
+
char*
mono_identifier_unescape_type_name_chars (char* identifier);
*/
MonoArray*
mono_reflection_get_custom_attrs_data (MonoObject *obj)
+{
+ MonoError error;
+ MonoArray* result;
+ result = mono_reflection_get_custom_attrs_data_checked (obj, &error);
+ mono_error_cleanup (&error); /* FIXME new API that doesn't swallow the error */
+ return result;
+}
+
+/*
+ * mono_reflection_get_custom_attrs_data_checked:
+ * @obj: a reflection obj handle
+ * @error: set on error
+ *
+ * Returns an array of System.Reflection.CustomAttributeData,
+ * which include information about attributes reflected on
+ * types loaded using the Reflection Only methods
+ */
+MonoArray*
+mono_reflection_get_custom_attrs_data_checked (MonoObject *obj, MonoError *error)
{
MonoArray *result;
MonoCustomAttrInfo *cinfo;
+ mono_error_init (error);
+
cinfo = mono_reflection_get_custom_attrs_info (obj);
if (cinfo) {
result = mono_custom_attrs_data_construct (cinfo);
} else
result = mono_array_new (mono_domain_get (), mono_defaults.customattribute_data_class, 0);
+ if (mono_loader_get_last_error ())
+ mono_error_set_from_loader_error (error);
+
return result;
}
MONO_API MonoArray* mono_reflection_get_custom_attrs_by_type (MonoObject *obj, MonoClass *attr_klass, MonoError *error);
MONO_API MonoArray* mono_reflection_get_custom_attrs (MonoObject *obj);
+MONO_RT_EXTERNAL_ONLY
MONO_API MonoArray* mono_reflection_get_custom_attrs_data (MonoObject *obj);
MONO_API MonoArray* mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *porpValues, MonoArray *fields, MonoArray* fieldValues);
static int last_major_gc_warned = -1;
static int num_degraded = 0;
- if (last_major_gc_warned < gc_stats.major_gc_count) {
+ if (last_major_gc_warned < (int)gc_stats.major_gc_count) {
++num_degraded;
if (num_degraded == 1 || num_degraded == 3)
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "Warning: Degraded allocation. Consider increasing nursery-size if the warning persists.");
* Returns NULL if the something cannot be loaded.
*/
gpointer
-mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code)
+mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code, MonoError *error)
{
#ifdef MONO_ARCH_AOT_SUPPORTED
guint8 *p, *target, *plt_entry;
MonoAotModule *module = (MonoAotModule*)aot_module;
gboolean res, no_ftnptr = FALSE;
MonoMemPool *mp;
- MonoError error;
gboolean using_gsharedvt = FALSE;
+ mono_error_init (error);
+
//printf ("DYN: %p %d\n", aot_module, plt_info_offset);
p = &module->blob [plt_info_offset];
*/
if (mono_aot_only && ji.type == MONO_PATCH_INFO_METHOD && !ji.data.method->is_generic && !mono_method_check_context_used (ji.data.method) && !(ji.data.method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) &&
!mono_method_needs_static_rgctx_invoke (ji.data.method, FALSE) && !using_gsharedvt) {
- target = (guint8 *)mono_jit_compile_method (ji.data.method, &error);
- if (!mono_error_ok (&error))
- mono_error_raise_exception (&error);
+ target = (guint8 *)mono_jit_compile_method (ji.data.method, error);
+ if (!mono_error_ok (error))
+ return NULL;
no_ftnptr = TRUE;
} else {
- target = (guint8 *)mono_resolve_patch_target (NULL, mono_domain_get (), NULL, &ji, TRUE);
+ target = (guint8 *)mono_resolve_patch_target_checked (NULL, mono_domain_get (), NULL, &ji, TRUE, error);
+ if (!mono_error_ok (error))
+ return NULL;
}
/*
}
gpointer
-mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code)
+mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code, MonoError *error)
{
return NULL;
}
#include <llvm/IR/Function.h>
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/Module.h>
+#include <llvm/IR/DIBuilder.h>
#include "mini-llvm-cpp.h"
{
unwrap<CallInst>(func)->setCallingConv (CallingConv::PreserveAll);
}
+
+void
+mono_llvm_create_di_compile_unit (LLVMModuleRef module)
+{
+ DIBuilder d(*unwrap(module));
+
+ d.createCompileUnit (0, "X", "Y", "Z", false, "", 0, "", DIBuilder::DebugEmissionKind::FullDebug, true);
+}
void
default_mono_llvm_unhandled_exception (void);
+void
+mono_llvm_create_di_compile_unit (LLVMModuleRef module);
+
G_END_DECLS
#endif /* __MONO_MINI_LLVM_CPP_H__ */
emit_dbg_info (&aot_module, filename, cu_name);
emit_aot_file_info (&aot_module);
+ mono_llvm_create_di_compile_unit (aot_module.lmodule);
+
/*
* Replace GOT entries for directly callable methods with the methods themselves.
* It would be easier to implement this by predefining all methods before compiling
}
gpointer
-mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors)
+mono_resolve_patch_target_checked (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors, MonoError *error)
{
unsigned char *ip = patch_info->ip.i + code;
gconstpointer target = NULL;
+ mono_error_init (error);
+
switch (patch_info->type) {
case MONO_PATCH_INFO_BB:
/*
case MONO_PATCH_INFO_TYPE_FROM_HANDLE: {
gpointer handle;
MonoClass *handle_class;
- MonoError error;
handle = mono_ldtoken_checked (patch_info->data.token->image,
- patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, &error);
- if (!mono_error_ok (&error))
- g_error ("Could not patch ldtoken due to %s", mono_error_get_message (&error));
+ patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, error);
+ if (!mono_error_ok (error))
+ g_error ("Could not patch ldtoken due to %s", mono_error_get_message (error));
mono_class_init (handle_class);
mono_class_init (mono_class_from_mono_type ((MonoType *)handle));
- target = mono_type_get_object_checked (domain, (MonoType *)handle, &error);
- mono_error_raise_exception (&error);
-
+ target = mono_type_get_object_checked (domain, (MonoType *)handle, error);
+ if (!mono_error_ok (error))
+ return NULL;
break;
}
case MONO_PATCH_INFO_LDTOKEN: {
gpointer handle;
MonoClass *handle_class;
- MonoError error;
handle = mono_ldtoken_checked (patch_info->data.token->image,
- patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, &error);
- if (!mono_error_ok (&error))
- g_error ("Could not patch ldtoken due to %s", mono_error_get_message (&error));
+ patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, error);
+ if (!mono_error_ok (error))
+ g_error ("Could not patch ldtoken due to %s", mono_error_get_message (error));
mono_class_init (handle_class);
target = handle;
if (run_cctors) {
target = mono_lookup_pinvoke_call (patch_info->data.method, &exc_class, &exc_arg);
if (!target) {
- if (mono_aot_only)
- mono_raise_exception (mono_exception_from_name_msg (mono_defaults.corlib, "System", exc_class, exc_arg));
+ if (mono_aot_only) {
+ mono_error_set_exception_instance (error, mono_exception_from_name_msg (mono_defaults.corlib, "System", exc_class, exc_arg));
+ return NULL;
+ }
g_error ("Unable to resolve pinvoke method '%s' Re-run with MONO_LOG_LEVEL=debug for more information.\n", mono_method_full_name (patch_info->data.method, TRUE));
}
} else {
return (gpointer)target;
}
+gpointer
+mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors)
+{
+ MonoError error;
+ gpointer res;
+
+ res = mono_resolve_patch_target_checked (method, domain, code, patch_info, run_cctors, &error);
+ mono_error_raise_exception (&error); /* FIXME don't raise here */
+ return res;
+}
+
void
mini_init_gsctx (MonoDomain *domain, MonoMemPool *mp, MonoGenericContext *context, MonoGenericSharingContext *gsctx)
{
{
guint32 plt_info_offset = mono_aot_get_plt_info_offset (regs, code);
gpointer res;
+ MonoError error;
trampoline_calls ++;
- res = mono_aot_plt_resolve (aot_module, plt_info_offset, code);
+ res = mono_aot_plt_resolve (aot_module, plt_info_offset, code, &error);
if (!res) {
+ if (!mono_error_ok (&error)) {
+ mono_error_set_pending_exception (&error);
+ return NULL;
+ }
if (mono_loader_get_last_error ()) {
MonoError error;
gint mono_patch_info_equal (gconstpointer ka, gconstpointer kb);
MonoJumpInfo *mono_patch_info_list_prepend (MonoJumpInfo *list, int ip, MonoJumpInfoType type, gconstpointer target);
gpointer mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors) MONO_LLVM_INTERNAL;
+gpointer mono_resolve_patch_target_checked (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors, MonoError *error) MONO_LLVM_INTERNAL;
gpointer mono_jit_find_compiled_method_with_jit_info (MonoDomain *domain, MonoMethod *method, MonoJitInfo **ji);
gpointer mono_jit_find_compiled_method (MonoDomain *domain, MonoMethod *method);
gpointer mono_jit_compile_method (MonoMethod *method, MonoError *error);
gboolean mono_aot_get_cached_class_info (MonoClass *klass, MonoCachedClassInfo *res);
gboolean mono_aot_get_class_from_name (MonoImage *image, const char *name_space, const char *name, MonoClass **klass);
MonoJitInfo* mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr);
-gpointer mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code);
+gpointer mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code, MonoError *error);
void mono_aot_patch_plt_entry (guint8 *code, guint8 *plt_entry, gpointer *got, mgreg_t *regs, guint8 *addr);
gpointer mono_aot_get_method_from_vt_slot (MonoDomain *domain, MonoVTable *vtable, int slot);
gpointer mono_aot_create_specific_trampoline (MonoImage *image, gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len);
if (!for_mature) {
sgen_client_degraded_allocation (size);
SGEN_ATOMIC_ADD_P (degraded_mode, size);
- sgen_ensure_free_space (size);
+ sgen_ensure_free_space (size, GENERATION_OLD);
} else {
if (sgen_need_major_collection (size))
sgen_perform_collection (size, GENERATION_OLD, "mature allocation failure", !for_mature);
* always loop we will loop endlessly in the case of
* OOM).
*/
- sgen_ensure_free_space (real_size);
+ sgen_ensure_free_space (real_size, GENERATION_NURSERY);
if (!degraded_mode)
p = (void **)sgen_nursery_alloc (size);
}
p = (void **)sgen_nursery_alloc_range (tlab_size, size, &alloc_size);
if (!p) {
/* See comment above in similar case. */
- sgen_ensure_free_space (tlab_size);
+ sgen_ensure_free_space (tlab_size, GENERATION_NURSERY);
if (!degraded_mode)
p = (void **)sgen_nursery_alloc_range (tlab_size, size, &alloc_size);
}
*/
#define SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO 0.33
-/*
- * How much more we allow the heap to grow, relative to the allowance, while doing
- * a concurrent collection, before forcing its finish.
- */
-#define SGEN_DEFAULT_CONCURRENT_HEAP_ALLOWANCE_RATIO 0.25
-
/*
* Default ratio of memory we want to release in a major collection in relation to the the current heap size.
*
time_major_fragment_creation += TV_ELAPSED (atv, btv);
binary_protocol_sweep_begin (GENERATION_OLD, !major_collector.sweeps_lazily);
+ sgen_memgov_major_pre_sweep ();
TV_GETTIME (atv);
time_major_free_bigobjs += TV_ELAPSED (btv, atv);
* LOCKING: The GC lock MUST be held.
*/
void
-sgen_ensure_free_space (size_t size)
+sgen_ensure_free_space (size_t size, int generation)
{
int generation_to_collect = -1;
const char *reason = NULL;
- if (size > SGEN_MAX_SMALL_OBJ_SIZE) {
+ if (generation == GENERATION_OLD) {
if (sgen_need_major_collection (size)) {
reason = "LOS overflow";
generation_to_collect = GENERATION_OLD;
void sgen_pin_object (GCObject *object, SgenGrayQueue *queue);
void sgen_set_pinned_from_failed_allocation (mword objsize);
-void sgen_ensure_free_space (size_t size);
+void sgen_ensure_free_space (size_t size, int generation);
void sgen_gc_collect (int generation);
void sgen_perform_collection (size_t requested_size, int generation_to_collect, const char *reason, gboolean wait_to_finish);
los_segment_index += size + sizeof (LOSObject);
g_assert (los_segment_index <= LOS_SEGMENT_SIZE);
#else
- sgen_ensure_free_space (size);
+ sgen_ensure_free_space (size, GENERATION_OLD);
#ifdef USE_MALLOC
obj = malloc (size + sizeof (LOSObject));
int count = 0;
#ifdef __GNUC__
- if (sizeof (mword) == sizeof (unsigned long))
- count += __builtin_popcountl (d);
+ if (sizeof (mword) == 8)
+ count += __builtin_popcountll (d);
else
count += __builtin_popcount (d);
#else
/* use this to tune when to do a major/minor collection */
static mword major_collection_trigger_size;
+static mword major_pre_sweep_heap_size;
+static mword major_start_heap_size;
+
static mword last_major_num_sections = 0;
static mword last_los_memory_usage = 0;
sgen_memgov_calculate_minor_collection_allowance (void)
{
size_t new_major, new_heap_size, allowance_target, allowance;
+ size_t decrease;
if (!need_calculate_minor_collection_allowance)
return;
allowance = MAX (allowance_target, MIN_MINOR_COLLECTION_ALLOWANCE);
+ /*
+ * For the concurrent collector, we decrease the allowance relative to the memory
+ * growth during the M&S phase, survival rate of the collection and the allowance
+ * ratio.
+ */
+ decrease = (major_pre_sweep_heap_size - major_start_heap_size) * ((float)new_heap_size / major_pre_sweep_heap_size) * (SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO + 1);
+ if (decrease > allowance)
+ decrease = allowance;
+ allowance -= decrease;
+
if (new_heap_size + allowance > soft_heap_limit) {
if (new_heap_size > soft_heap_limit)
allowance = MIN_MINOR_COLLECTION_ALLOWANCE;
if (heap_size <= major_collection_trigger_size)
return FALSE;
- /* We allow the heap to grow an additional third of the allowance during a concurrent collection */
- if ((heap_size - major_collection_trigger_size) >
- (major_collection_trigger_size
- * (SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO / (SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO + 1))
- * SGEN_DEFAULT_CONCURRENT_HEAP_ALLOWANCE_RATIO)) {
+ /*
+ * The more the heap grows, the more we need to decrease the allowance above,
+ * in order to have similar trigger sizes as the synchronous collector.
+ * If the heap grows so much that we would need to have a negative allowance,
+ * we force the finishing of the collection, to avoid increased memory usage.
+ */
+ if ((heap_size - major_start_heap_size) > major_start_heap_size * SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO)
return TRUE;
- }
return FALSE;
}
{
}
+void
+sgen_memgov_major_pre_sweep (void)
+{
+ if (sgen_concurrent_collection_in_progress ()) {
+ major_pre_sweep_heap_size = get_heap_size ();
+ } else {
+ /* We decrease the allowance only in the concurrent case */
+ major_pre_sweep_heap_size = major_start_heap_size;
+ }
+}
+
void
sgen_memgov_major_collection_start (void)
{
need_calculate_minor_collection_allowance = TRUE;
+ major_start_heap_size = get_heap_size ();
if (debug_print_allowance) {
- SGEN_LOG (0, "Starting collection with heap size %ld bytes", (long)get_heap_size ());
+ SGEN_LOG (0, "Starting collection with heap size %ld bytes", (long)major_start_heap_size);
}
}
void sgen_memgov_minor_collection_start (void);
void sgen_memgov_minor_collection_end (void);
+void sgen_memgov_major_pre_sweep (void);
void sgen_memgov_major_collection_start (void);
void sgen_memgov_major_collection_end (gboolean forced);
SUBDIRS = assemblyresolve gc-descriptors
-check-local: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test-cattr-type-load test-reflection-load-with-context test_platform \
- test-console-output test-messages test-env-options test-unhandled-exception-2 test-appdomain-unload test-process-stress rm-empty-logs
+check-local: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test-cattr-type-load test-reflection-load-with-context test_platform test-process-exit test-console-output test-messages test-env-options test-unhandled-exception-2 test-appdomain-unload rm-empty-logs
check-full: test-sgen check-local
check-parallel: compile-tests check-full
@diff -w console-output.exe.stdout $(srcdir)/console-output.exe.stdout.expected \
&& diff -w console-output.exe.stderr $(srcdir)/console-output.exe.stderr.expected
-PROCESS_STRESS_TESTS= \
- process-stress-1.exe \
- process-stress-2.exe \
- process-stress-3.exe
-
-test-process-stress: $(PROCESS_STRESS_TESTS) test-runner.exe
- $(RUNTIME) ./test-runner.exe --testsuite-name $@ $(PROCESS_STRESS_TESTS)
-
coreclr-gcstress:
$(MAKE) -C $(mono_build_root)/acceptance-tests coreclr-gcstress
return 2;
}
+ public static int test_0_reflection_on_field_with_missing_custom_attr () {
+ var t = typeof (BadOverridesDriver).Assembly.GetType ("FieldWithMissingCustomAttribute");
+ try {
+ Console.WriteLine (t.GetFields ()[0].CustomAttributes);
+ return 1;
+ } catch (FileNotFoundException) {
+ return 0;
+ }
+ return 2;
+ }
public static int Main () {
return TestDriver.RunTests (typeof (Tests));
{\r
.ver 0:0:0:0\r
}\r
+.assembly extern notFoundAssembly\r
+{\r
+ .ver 0:0:0:0\r
+}\r
\r
.assembly 'load-missing'\r
{\r
.field public class [t]Missing BrokenField\r
.field public static int32 WorkingField\r
}\r
+\r
+.class public auto ansi beforefieldinit FieldWithMissingCustomAttribute\r
+{\r
+ .field public object f\r
+ .custom instance void class [notFoundAssembly]SomeAttribute::'.ctor'() = (01 00 00 00 ) // ....\r
+}\r
+++ /dev/null
-
-using System;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-
-class Driver
-{
- static void Main ()
- {
- for (int i = 0; i < 1000; ++i) {
- ProcessStartInfo psi = new ProcessStartInfo () {
- FileName = "echo",
- Arguments = "hello 1>/dev/null",
- };
-
- Process p = Process.Start (psi);
-
- ManualResetEvent mre = new ManualResetEvent (false);
-
- Task t = Task.Run (() => {
- mre.Set ();
- if (!p.WaitForExit (1000))
- Environment.Exit (1);
- });
-
- if (!mre.WaitOne (1000))
- Environment.Exit (2);
- if (!p.WaitForExit (1000))
- Environment.Exit (3);
-
- if (!t.Wait (1000))
- Environment.Exit (4);
- }
- }
-}
+++ /dev/null
-
-using System;
-using System.Diagnostics;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-
-class Driver
-{
- static void Main ()
- {
- Action<Process>[] tests = new Action<Process> [] {
- new Action<Process> (Test1),
- new Action<Process> (Test2),
- };
-
- ProcessStartInfo psi = new ProcessStartInfo () {
- FileName = "echo",
- Arguments = "hello",
- UseShellExecute = false,
- RedirectStandardOutput = true,
- };
-
- foreach (Action<Process> test in tests) {
- for (int i = 0; i < 500; ++i) {
- test (new Process () { StartInfo = psi });
- }
- }
- }
-
- static void Test1 (Process p)
- {
- StringBuilder sb = new StringBuilder ();
- ManualResetEvent mre_exit = new ManualResetEvent (false);
- ManualResetEvent mre_output = new ManualResetEvent (false);
-
- p.EnableRaisingEvents = true;
- p.Exited += (s, a) => mre_exit.Set ();
-
- p.Start ();
-
- p.OutputDataReceived += (s, a) => {
- if (a.Data == null) {
- mre_output.Set ();
- return;
- }
- sb.Append (a.Data);
- };
-
- p.BeginOutputReadLine ();
-
- if (!mre_exit.WaitOne (1000))
- Environment.Exit (1);
- if (!mre_output.WaitOne (1000))
- Environment.Exit (2);
-
- if (sb.ToString () != "hello") {
- Console.WriteLine ("process output = '{0}'", sb.ToString ());
- Environment.Exit (3);
- }
- }
-
- static void Test2 (Process p)
- {
- StringBuilder sb = new StringBuilder ();
- ManualResetEvent mre_output = new ManualResetEvent (false);
-
- p.Start ();
-
- p.OutputDataReceived += (s, a) => {
- if (a.Data == null) {
- mre_output.Set ();
- return;
- }
-
- sb.Append (a.Data);
- };
-
- p.BeginOutputReadLine ();
-
- if (!p.WaitForExit (1000))
- Environment.Exit (4);
- if (!mre_output.WaitOne (1000))
- Environment.Exit (5);
-
- if (sb.ToString () != "hello") {
- Console.WriteLine ("process output = '{0}'", sb.ToString ());
- Environment.Exit (6);
- }
- }
-}
+++ /dev/null
-
-using System;
-using System.Diagnostics;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-
-class Driver
-{
- static void Main ()
- {
- Action<Process>[] tests = new Action<Process> [] {
- new Action<Process> (Test1),
- new Action<Process> (Test2),
- };
-
- ProcessStartInfo psi = new ProcessStartInfo () {
- FileName = "find",
- Arguments = "/ -maxdepth 4",
- UseShellExecute = false,
- RedirectStandardOutput = true,
- RedirectStandardError = true,
- };
-
- foreach (Action<Process> test in tests) {
- for (int i = 0; i < 200; ++i) {
- test (new Process () { StartInfo = psi });
- }
- }
- }
-
- static void Test1 (Process p)
- {
- ManualResetEvent mre_exit = new ManualResetEvent (false);
- ManualResetEvent mre_output = new ManualResetEvent (false);
- ManualResetEvent mre_error = new ManualResetEvent (false);
-
- p.EnableRaisingEvents = true;
- p.Exited += (s, a) => mre_exit.Set ();
-
- p.Start ();
-
- p.OutputDataReceived += (s, a) => {
- if (a.Data == null) {
- mre_output.Set ();
- return;
- }
- };
-
- p.ErrorDataReceived += (s, a) => {
- if (a.Data == null) {
- mre_error.Set ();
- return;
- }
- };
-
- p.BeginOutputReadLine ();
- p.BeginErrorReadLine ();
-
- if (!mre_exit.WaitOne (10000))
- Environment.Exit (1);
- if (!mre_output.WaitOne (1000))
- Environment.Exit (2);
- if (!mre_error.WaitOne (1000))
- Environment.Exit (3);
- }
-
- static void Test2 (Process p)
- {
- ManualResetEvent mre_output = new ManualResetEvent (false);
- ManualResetEvent mre_error = new ManualResetEvent (false);
-
- p.Start ();
-
- p.OutputDataReceived += (s, a) => {
- if (a.Data == null) {
- mre_output.Set ();
- return;
- }
- };
-
- p.ErrorDataReceived += (s, a) => {
- if (a.Data == null) {
- mre_error.Set ();
- return;
- }
- };
-
- p.BeginOutputReadLine ();
- p.BeginErrorReadLine ();
-
- if (!p.WaitForExit (10000))
- Environment.Exit (4);
- if (!mre_output.WaitOne (1000))
- Environment.Exit (5);
- if (!mre_error.WaitOne (1000))
- Environment.Exit (6);
- }
-}