Signed-off-by: Zebediah Figura z.figura12@gmail.com --- include/wine/test.h | 58 ++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 30 deletions(-)
diff --git a/include/wine/test.h b/include/wine/test.h index 078b0147c4f..6864619f8c9 100644 --- a/include/wine/test.h +++ b/include/wine/test.h @@ -295,19 +295,31 @@ const char *winetest_elapsed(void) return wine_dbg_sprintf( "%.3f", (now - winetest_start_time) / 1000.0); }
-void winetest_subtest( const char* name ) +static void winetest_vprintf( const char *msg, __winetest_va_list args ) { struct tls_data *data = get_tls_data(); - printf( "%s:%d:%s Subtest %s\n", - data->current_file, data->current_line, winetest_elapsed(), name ); + + printf( "%s:%d:%s ", data->current_file, data->current_line, winetest_elapsed() ); + vprintf( msg, args ); +} + +static void winetest_printf( const char *msg, ... ) +{ + __winetest_va_list valist; + + __winetest_va_start( valist, msg ); + winetest_vprintf( msg, valist ); + __winetest_va_end( valist ); +} + +void winetest_subtest( const char* name ) +{ + winetest_printf( "Subtest %s\n", name ); }
void winetest_ignore_exceptions( BOOL ignore ) { - struct tls_data *data = get_tls_data(); - printf( "%s:%d:%s IgnoreExceptions=%d\n", - data->current_file, data->current_line, winetest_elapsed(), - ignore ? 1 : 0 ); + winetest_printf( "IgnoreExceptions=%d\n", ignore ? 1 : 0 ); }
int broken( int condition ) @@ -327,9 +339,7 @@ static LONG winetest_add_line( void ) index = data->current_line % ARRAY_SIZE(line_counters); count = InterlockedIncrement(line_counters + index) - 1; if (count == winetest_mute_threshold) - printf( "%s:%d:%s Line has been silenced after %d occurrences\n", - data->current_file, data->current_line, winetest_elapsed(), - winetest_mute_threshold ); + winetest_printf( "Line has been silenced after %d occurrences\n", winetest_mute_threshold );
return count; } @@ -352,8 +362,7 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) { if (condition) { - printf( "%s:%d:%s Test succeeded inside todo block: ", - data->current_file, data->current_line, winetest_elapsed() ); + winetest_printf( "Test succeeded inside todo block: " ); vprintf(msg, args); InterlockedIncrement(&todo_failures); return 0; @@ -365,8 +374,7 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) { if (winetest_debug > 0) { - printf( "%s:%d:%s Test marked todo: ", - data->current_file, data->current_line, winetest_elapsed() ); + winetest_printf( "Test marked todo: " ); vprintf(msg, args); } InterlockedIncrement(&todo_successes); @@ -380,8 +388,7 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) { if (!condition) { - printf( "%s:%d:%s Test failed: ", - data->current_file, data->current_line, winetest_elapsed() ); + winetest_printf( "Test failed: " ); vprintf(msg, args); InterlockedIncrement(&failures); return 0; @@ -391,8 +398,7 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) if (winetest_report_success || (winetest_time && GetTickCount() >= winetest_last_time + 1000)) { - printf( "%s:%d:%s Test succeeded\n", - data->current_file, data->current_line, winetest_elapsed() ); + winetest_printf( "Test succeeded\n" ); } InterlockedIncrement(&successes); return 1; @@ -417,10 +423,8 @@ void __winetest_cdecl winetest_trace( const char *msg, ... ) return; if (winetest_add_line() < winetest_mute_threshold) { - struct tls_data *data = get_tls_data(); - printf( "%s:%d:%s ", data->current_file, data->current_line, winetest_elapsed() ); __winetest_va_start(valist, msg); - vprintf(msg, valist); + winetest_vprintf( msg, valist ); __winetest_va_end(valist); } else @@ -431,8 +435,7 @@ void winetest_vskip( const char *msg, __winetest_va_list args ) { if (winetest_add_line() < winetest_mute_threshold) { - struct tls_data *data = get_tls_data(); - printf( "%s:%d:%s Tests skipped: ", data->current_file, data->current_line, winetest_elapsed() ); + winetest_printf( "Tests skipped: " ); vprintf(msg, args); InterlockedIncrement(&skipped); } @@ -513,21 +516,16 @@ void winetest_wait_child_process( HANDLE process ) else { DWORD exit_code; - struct tls_data *data = get_tls_data(); GetExitCodeProcess( process, &exit_code ); if (exit_code > 255) { DWORD pid = GetProcessId( process ); - printf( "%s:%d:%s unhandled exception %08x in child process %04x\n", - data->current_file, data->current_line, winetest_elapsed(), - exit_code, pid ); + winetest_printf( "unhandled exception %08x in child process %04x\n", exit_code, pid ); InterlockedIncrement( &failures ); } else if (exit_code) { - printf( "%s:%d:%s %u failures in child process\n", - data->current_file, data->current_line, winetest_elapsed(), - exit_code ); + winetest_printf( "%u failures in child process\n", exit_code ); while (exit_code-- > 0) InterlockedIncrement(&failures); }
Based on vkd3d's vkd3d_test_set_context(), but adding support for a stack of context prefixes, to more easily accomodate tests with nested loops.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- include/wine/test.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
diff --git a/include/wine/test.h b/include/wine/test.h index 6864619f8c9..1245582150e 100644 --- a/include/wine/test.h +++ b/include/wine/test.h @@ -96,6 +96,9 @@ extern void __winetest_cdecl winetest_skip( const char *msg, ... ) __WINE_PRINTF extern void __winetest_cdecl winetest_win_skip( const char *msg, ... ) __WINE_PRINTF_ATTR(1,2); extern void __winetest_cdecl winetest_trace( const char *msg, ... ) __WINE_PRINTF_ATTR(1,2);
+extern void __winetest_cdecl winetest_push_context( const char *fmt, ... ) __WINE_PRINTF_ATTR(1, 2); +extern void winetest_pop_context(void); + #ifdef WINETEST_NO_LINE_NUMBERS # define subtest_(file, line) (winetest_set_location(file, 0), 0) ? (void)0 : winetest_subtest # define ignore_exceptions_(file, line) (winetest_set_location(file, 0), 0) ? (void)0 : winetest_ignore_exceptions @@ -246,6 +249,8 @@ struct tls_data int todo_do_loop; char *str_pos; /* position in debug buffer */ char strings[2000]; /* buffer for debug strings */ + char context[8][1024]; /* data to print before messages */ + unsigned int context_count; /* number of context prefixes */ }; static DWORD tls_index;
@@ -298,8 +303,11 @@ const char *winetest_elapsed(void) static void winetest_vprintf( const char *msg, __winetest_va_list args ) { struct tls_data *data = get_tls_data(); + unsigned int i;
printf( "%s:%d:%s ", data->current_file, data->current_line, winetest_elapsed() ); + for (i = 0; i < data->context_count; ++i) + printf( "%s: ", data->context[i] ); vprintf( msg, args ); }
@@ -483,6 +491,29 @@ void winetest_end_todo(void) data->todo_level >>= 1; }
+void __winetest_cdecl winetest_push_context( const char *fmt, ... ) +{ + struct tls_data *data = get_tls_data(); + __winetest_va_list valist; + + if (data->context_count < ARRAY_SIZE(data->context)) + { + __winetest_va_start(valist, fmt); + vsnprintf( data->context[data->context_count], sizeof(data->context[data->context_count]), fmt, valist ); + __winetest_va_end(valist); + data->context[data->context_count][sizeof(data->context[data->context_count]) - 1] = 0; + } + ++data->context_count; +} + +void winetest_pop_context(void) +{ + struct tls_data *data = get_tls_data(); + + if (data->context_count) + --data->context_count; +} + int winetest_get_mainargs( char*** pargv ) { *pargv = winetest_argv;
On Sun, 25 Apr 2021, Zebediah Figura wrote: [...]
@@ -298,8 +303,11 @@ const char *winetest_elapsed(void) static void winetest_vprintf( const char *msg, __winetest_va_list args ) { struct tls_data *data = get_tls_data();
unsigned int i;
printf( "%s:%d:%s ", data->current_file, data->current_line, winetest_elapsed() );
for (i = 0; i < data->context_count; ++i)
printf( "%s: ", data->context[i] );
vprintf( msg, args );
}
This prevents the TestBot and test.winehq.org from recognizing test failures when there's a context string. The Testbot expects
[_a-z0-9]+.c:\d+:[0-9.]* Test failed:
But it gets lines like this instead:
registry.c:4104: L"Bahia Standard Time": Test failed: expected L"Bahia Daylight Time", got L"Bahia (heure d'\00e9t\00e9)"
Ideally the context would go after "Test failed:". Otherwise that means allowing anything in between the file+line and "Test failed:" which increases the risk of allowing bad matches.
Note: Same goes for "Test succeeded inside todo block", "Test marked todo", etc.
On 5/15/21 9:48 AM, Francois Gouget wrote:
On Sun, 25 Apr 2021, Zebediah Figura wrote: [...]
@@ -298,8 +303,11 @@ const char *winetest_elapsed(void) static void winetest_vprintf( const char *msg, __winetest_va_list args ) { struct tls_data *data = get_tls_data();
unsigned int i;
printf( "%s:%d:%s ", data->current_file, data->current_line, winetest_elapsed() );
for (i = 0; i < data->context_count; ++i)
printf( "%s: ", data->context[i] ); vprintf( msg, args );
}
This prevents the TestBot and test.winehq.org from recognizing test failures when there's a context string. The Testbot expects
[_a-z0-9]+\.c:\d+:[0-9.]* Test failed:
But it gets lines like this instead:
registry.c:4104: L"Bahia Standard Time": Test failed: expected L"Bahia Daylight Time", got L"Bahia (heure d'\00e9t\00e9)"
Ideally the context would go after "Test failed:". Otherwise that means allowing anything in between the file+line and "Test failed:" which increases the risk of allowing bad matches.
Note: Same goes for "Test succeeded inside todo block", "Test marked todo", etc.
Sorry, I didn't consider that. I've sent a patch.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- This is an example where the nested context support is particularly helpful.
dlls/d3dcompiler_43/tests/hlsl_d3d11.c | 160 ++++++++++++++----------- 1 file changed, 91 insertions(+), 69 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d11.c b/dlls/d3dcompiler_43/tests/hlsl_d3d11.c index 53dbd3e2df7..36716ed753d 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d11.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d11.c @@ -621,6 +621,8 @@ static void test_sampling(void)
for (i = 0; i < ARRAY_SIZE(tests); ++i) { + winetest_push_context("Test %u", i); + ID3D11DeviceContext_ClearRenderTargetView(test_context.immediate_context, test_context.rtv, red); todo_wine ps_code = compile_shader_flags(tests[i], "ps_4_0", D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY); if (ps_code) @@ -629,10 +631,12 @@ static void test_sampling(void)
v = get_color_vec4(&test_context, 0, 0); todo_wine ok(compare_vec4(&v, 0.25f, 0.0f, 0.25f, 0.0f, 0), - "Test %u: Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", i, v.x, v.y, v.z, v.w); + "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
ID3D10Blob_Release(ps_code); } + + winetest_pop_context(); }
ID3D11Texture2D_Release(texture); @@ -641,30 +645,29 @@ static void test_sampling(void) release_test_context(&test_context); }
-static void check_type_desc(const char *prefix, const D3D11_SHADER_TYPE_DESC *type, - const D3D11_SHADER_TYPE_DESC *expect) +static void check_type_desc(const D3D11_SHADER_TYPE_DESC *type, const D3D11_SHADER_TYPE_DESC *expect) { - ok(type->Class == expect->Class, "%s: got class %#x.\n", prefix, type->Class); - ok(type->Type == expect->Type, "%s: got type %#x.\n", prefix, type->Type); - ok(type->Rows == expect->Rows, "%s: got %u rows.\n", prefix, type->Rows); - ok(type->Columns == expect->Columns, "%s: got %u columns.\n", prefix, type->Columns); - ok(type->Elements == expect->Elements, "%s: got %u elements.\n", prefix, type->Elements); - ok(type->Members == expect->Members, "%s: got %u members.\n", prefix, type->Members); - ok(type->Offset == expect->Offset, "%s: got %u members.\n", prefix, type->Members); - ok(!strcmp(type->Name, expect->Name), "%s: got name %s.\n", prefix, debugstr_a(type->Name)); + ok(type->Class == expect->Class, "Got class %#x.\n", type->Class); + ok(type->Type == expect->Type, "Got type %#x.\n", type->Type); + ok(type->Rows == expect->Rows, "Got %u rows.\n", type->Rows); + ok(type->Columns == expect->Columns, "Got %u columns.\n", type->Columns); + ok(type->Elements == expect->Elements, "Got %u elements.\n", type->Elements); + ok(type->Members == expect->Members, "Got %u members.\n", type->Members); + ok(type->Offset == expect->Offset, "Got %u members.\n", type->Members); + ok(!strcmp(type->Name, expect->Name), "Got name %s.\n", debugstr_a(type->Name)); }
-static void check_resource_binding(const char *prefix, const D3D11_SHADER_INPUT_BIND_DESC *desc, +static void check_resource_binding(const D3D11_SHADER_INPUT_BIND_DESC *desc, const D3D11_SHADER_INPUT_BIND_DESC *expect) { - ok(!strcmp(desc->Name, expect->Name), "%s: got name %s.\n", prefix, debugstr_a(desc->Name)); - ok(desc->Type == expect->Type, "%s: got type %#x.\n", prefix, desc->Type); - ok(desc->BindPoint == expect->BindPoint, "%s: got bind point %u.\n", prefix, desc->BindPoint); - ok(desc->BindCount == expect->BindCount, "%s: got bind count %u.\n", prefix, desc->BindCount); - ok(desc->uFlags == expect->uFlags, "%s: got flags %#x.\n", prefix, desc->uFlags); - ok(desc->ReturnType == expect->ReturnType, "%s: got return type %#x.\n", prefix, desc->ReturnType); - ok(desc->Dimension == expect->Dimension, "%s: got dimension %#x.\n", prefix, desc->Dimension); - ok(desc->NumSamples == expect->NumSamples, "%s: got multisample count %u.\n", prefix, desc->NumSamples); + ok(!strcmp(desc->Name, expect->Name), "Got name %s.\n", debugstr_a(desc->Name)); + ok(desc->Type == expect->Type, "Got type %#x.\n", desc->Type); + ok(desc->BindPoint == expect->BindPoint, "Got bind point %u.\n", desc->BindPoint); + ok(desc->BindCount == expect->BindCount, "Got bind count %u.\n", desc->BindCount); + ok(desc->uFlags == expect->uFlags, "Got flags %#x.\n", desc->uFlags); + ok(desc->ReturnType == expect->ReturnType, "Got return type %#x.\n", desc->ReturnType); + ok(desc->Dimension == expect->Dimension, "Got dimension %#x.\n", desc->Dimension); + ok(desc->NumSamples == expect->NumSamples, "Got multisample count %u.\n", desc->NumSamples); }
static void test_reflection(void) @@ -679,7 +682,6 @@ static void test_reflection(void) D3D11_SHADER_DESC shader_desc; ID3D10Blob *code = NULL; unsigned int i, j, k; - char prefix[40]; ULONG refcount; HRESULT hr;
@@ -841,57 +843,66 @@ static void test_reflection(void)
for (i = 0; i < ARRAY_SIZE(vs_buffers); ++i) { + winetest_push_context("Buffer %u", i); + cbuffer = reflection->lpVtbl->GetConstantBufferByIndex(reflection, i); hr = cbuffer->lpVtbl->GetDesc(cbuffer, &buffer_desc); - ok(hr == S_OK, "Test %u: got hr %#x.\n", i, hr); - ok(!strcmp(buffer_desc.Name, vs_buffers[i].desc.Name), - "Test %u: got name %s.\n", i, debugstr_a(buffer_desc.Name)); - ok(buffer_desc.Type == vs_buffers[i].desc.Type, "Test %u: got type %#x.\n", i, buffer_desc.Type); - ok(buffer_desc.Variables == vs_buffers[i].desc.Variables, - "Test %u: got %u variables.\n", i, buffer_desc.Variables); - ok(buffer_desc.Size == vs_buffers[i].desc.Size, "Test %u: got size %u.\n", i, buffer_desc.Size); - ok(buffer_desc.uFlags == vs_buffers[i].desc.uFlags, "Test %u: got flags %#x.\n", i, buffer_desc.uFlags); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!strcmp(buffer_desc.Name, vs_buffers[i].desc.Name), "Got name %s.\n", debugstr_a(buffer_desc.Name)); + ok(buffer_desc.Type == vs_buffers[i].desc.Type, "Got type %#x.\n", buffer_desc.Type); + ok(buffer_desc.Variables == vs_buffers[i].desc.Variables, "Got %u variables.\n", buffer_desc.Variables); + ok(buffer_desc.Size == vs_buffers[i].desc.Size, "Got size %u.\n", buffer_desc.Size); + ok(buffer_desc.uFlags == vs_buffers[i].desc.uFlags, "Got flags %#x.\n", buffer_desc.uFlags);
for (j = 0; j < buffer_desc.Variables; ++j) { const struct shader_variable *expect = &vs_buffers[i].vars[j];
+ winetest_push_context("Variable %u", j); + var = cbuffer->lpVtbl->GetVariableByIndex(cbuffer, j); hr = var->lpVtbl->GetDesc(var, &var_desc); - ok(hr == S_OK, "Test %u, %u: got hr %#x.\n", i, j, hr); - ok(!strcmp(var_desc.Name, expect->var_desc.Name), - "Test %u, %u: got name %s.\n", i, j, debugstr_a(var_desc.Name)); - ok(var_desc.StartOffset == expect->var_desc.StartOffset, "Test %u, %u: got offset %u.\n", - i, j, var_desc.StartOffset); - ok(var_desc.Size == expect->var_desc.Size, "Test %u, %u: got size %u.\n", i, j, var_desc.Size); - ok(var_desc.uFlags == expect->var_desc.uFlags, "Test %u, %u: got flags %#x.\n", i, j, var_desc.uFlags); - ok(!var_desc.DefaultValue, "Test %u, %u: got default value %p.\n", i, j, var_desc.DefaultValue); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!strcmp(var_desc.Name, expect->var_desc.Name), "Got name %s.\n", debugstr_a(var_desc.Name)); + ok(var_desc.StartOffset == expect->var_desc.StartOffset, "Got offset %u.\n", var_desc.StartOffset); + ok(var_desc.Size == expect->var_desc.Size, "Got size %u.\n", var_desc.Size); + ok(var_desc.uFlags == expect->var_desc.uFlags, "Got flags %#x.\n", var_desc.uFlags); + ok(!var_desc.DefaultValue, "Got default value %p.\n", var_desc.DefaultValue);
type = var->lpVtbl->GetType(var); hr = type->lpVtbl->GetDesc(type, &type_desc); - ok(hr == S_OK, "Test %u, %u: got hr %#x.\n", i, j, hr); - sprintf(prefix, "Test %u, %u", i, j); - check_type_desc(prefix, &type_desc, &expect->type_desc); + ok(hr == S_OK, "Got hr %#x.\n", hr); + check_type_desc(&type_desc, &expect->type_desc);
for (k = 0; k < type_desc.Members; ++k) { + winetest_push_context("Field %u", k); + field = type->lpVtbl->GetMemberTypeByIndex(type, k); hr = field->lpVtbl->GetDesc(field, &type_desc); - ok(hr == S_OK, "Test %u, %u, %u: got hr %#x.\n", i, j, k, hr); - sprintf(prefix, "Test %u, %u, %u", i, j, k); - check_type_desc(prefix, &type_desc, &vs_buffers[i].vars[j].field_types[k]); + ok(hr == S_OK, "Got hr %#x.\n", hr); + check_type_desc(&type_desc, &vs_buffers[i].vars[j].field_types[k]); + + winetest_pop_context(); } + + winetest_pop_context(); } + + winetest_pop_context(); }
for (i = 0; i < ARRAY_SIZE(vs_bindings); ++i) { D3D11_SHADER_INPUT_BIND_DESC desc;
+ winetest_push_context("Binding %u", i); + hr = reflection->lpVtbl->GetResourceBindingDesc(reflection, i, &desc); - ok(hr == S_OK, "Test %u: got hr %#x.\n", i, hr); - sprintf(prefix, "Test %u", i); - check_resource_binding(prefix, &desc, &vs_bindings[i]); + ok(hr == S_OK, "Got hr %#x.\n", hr); + check_resource_binding(&desc, &vs_bindings[i]); + + winetest_pop_context(); }
ID3D10Blob_Release(code); @@ -912,10 +923,13 @@ static void test_reflection(void) { D3D11_SHADER_INPUT_BIND_DESC desc;
+ winetest_push_context("Binding %u", i); + hr = reflection->lpVtbl->GetResourceBindingDesc(reflection, i, &desc); - ok(hr == S_OK, "Test %u: got hr %#x.\n", i, hr); - sprintf(prefix, "Test %u", i); - check_resource_binding(prefix, &desc, &ps_bindings[i]); + ok(hr == S_OK, "Got hr %#x.\n", hr); + check_resource_binding(&desc, &ps_bindings[i]); + + winetest_pop_context(); }
ID3D10Blob_Release(code); @@ -923,18 +937,18 @@ static void test_reflection(void) ok(!refcount, "Got unexpected refcount %u.\n", refcount); }
-static void check_parameter_desc(const char *prefix, const D3D11_SIGNATURE_PARAMETER_DESC *desc, +static void check_parameter_desc(const D3D11_SIGNATURE_PARAMETER_DESC *desc, const D3D11_SIGNATURE_PARAMETER_DESC *expect) { - ok(!strcmp(desc->SemanticName, expect->SemanticName), "%s: got name %s.\n", prefix, debugstr_a(desc->SemanticName)); - ok(desc->SemanticIndex == expect->SemanticIndex, "%s: got index %u.\n", prefix, desc->SemanticIndex); - ok(desc->Register == expect->Register, "%s: got register %u.\n", prefix, desc->Register); - ok(desc->SystemValueType == expect->SystemValueType, "%s: got sysval %u.\n", prefix, desc->SystemValueType); - ok(desc->ComponentType == expect->ComponentType, "%s: got data type %u.\n", prefix, desc->ComponentType); - ok(desc->Mask == expect->Mask, "%s: got mask %#x.\n", prefix, desc->Mask); + ok(!strcmp(desc->SemanticName, expect->SemanticName), "Got name %s.\n", debugstr_a(desc->SemanticName)); + ok(desc->SemanticIndex == expect->SemanticIndex, "Got index %u.\n", desc->SemanticIndex); + ok(desc->Register == expect->Register, "Got register %u.\n", desc->Register); + ok(desc->SystemValueType == expect->SystemValueType, "Got sysval %u.\n", desc->SystemValueType); + ok(desc->ComponentType == expect->ComponentType, "Got data type %u.\n", desc->ComponentType); + ok(desc->Mask == expect->Mask, "Got mask %#x.\n", desc->Mask); todo_wine_if(desc->ReadWriteMask != expect->ReadWriteMask) - ok(desc->ReadWriteMask == expect->ReadWriteMask, "%s: got used mask %#x.\n", prefix, desc->ReadWriteMask); - ok(desc->Stream == expect->Stream, "%s: got stream %u.\n", prefix, desc->Stream); + ok(desc->ReadWriteMask == expect->ReadWriteMask, "Got used mask %#x.\n", desc->ReadWriteMask); + ok(desc->Stream == expect->Stream, "Got stream %u.\n", desc->Stream); }
static void test_semantic_reflection(void) @@ -944,7 +958,6 @@ static void test_semantic_reflection(void) D3D11_SHADER_DESC shader_desc; ID3D10Blob *code = NULL; unsigned int i, j; - char prefix[40]; ULONG refcount; HRESULT hr;
@@ -1117,41 +1130,50 @@ static void test_semantic_reflection(void)
for (i = 0; i < ARRAY_SIZE(tests); ++i) { + winetest_push_context("Test %u", i); + todo_wine code = compile_shader_flags(tests[i].source, tests[i].target, tests[i].legacy ? D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY : 0); if (!code) + { + winetest_pop_context(); continue; + }
hr = pD3DReflect(ID3D10Blob_GetBufferPointer(code), ID3D10Blob_GetBufferSize(code), &IID_ID3D11ShaderReflection, (void **)&reflection); - ok(hr == S_OK, "Test %u: got hr %#x.\n", i, hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = reflection->lpVtbl->GetDesc(reflection, &shader_desc); - ok(hr == S_OK, "Test %u: got hr %#x.\n", i, hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); todo_wine ok(shader_desc.InputParameters == tests[i].input_count, - "Test %u: got %u input parameters.\n", i, shader_desc.InputParameters); + "Got %u input parameters.\n", shader_desc.InputParameters); todo_wine ok(shader_desc.OutputParameters == tests[i].output_count, - "Test %u: got %u output parameters.\n", i, shader_desc.OutputParameters); + "Got %u output parameters.\n", shader_desc.OutputParameters);
for (j = 0; j < shader_desc.InputParameters; ++j) { + winetest_push_context("Input %u", j); hr = reflection->lpVtbl->GetInputParameterDesc(reflection, j, &desc); - ok(hr == S_OK, "Test %u, %u: got hr %#x.\n", i, j, hr); - sprintf(prefix, "Test %u, input %u", i, j); - check_parameter_desc(prefix, &desc, &tests[i].inputs[j]); + ok(hr == S_OK, "Got hr %#x.\n", hr); + check_parameter_desc(&desc, &tests[i].inputs[j]); + winetest_pop_context(); }
for (j = 0; j < shader_desc.OutputParameters; ++j) { + winetest_push_context("Output %u", j); hr = reflection->lpVtbl->GetOutputParameterDesc(reflection, j, &desc); - ok(hr == S_OK, "Test %u, %u: got hr %#x.\n", i, j, hr); - sprintf(prefix, "Test %u, output %u", i, j); - check_parameter_desc(prefix, &desc, &tests[i].outputs[j]); + ok(hr == S_OK, "Got hr %#x.\n", hr); + check_parameter_desc(&desc, &tests[i].outputs[j]); + winetest_pop_context(); }
ID3D10Blob_Release(code); refcount = reflection->lpVtbl->Release(reflection); ok(!refcount, "Got unexpected refcount %u.\n", refcount); + + winetest_pop_context(); } }
On Sun, Apr 25, 2021 at 10:10 PM Zebediah Figura z.figura12@gmail.com wrote:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
This is an example where the nested context support is particularly helpful.
dlls/d3dcompiler_43/tests/hlsl_d3d11.c | 160 ++++++++++++++----------- 1 file changed, 91 insertions(+), 69 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d11.c b/dlls/d3dcompiler_43/tests/hlsl_d3d11.c index 53dbd3e2df7..36716ed753d 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d11.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d11.c @@ -621,6 +621,8 @@ static void test_sampling(void)
for (i = 0; i < ARRAY_SIZE(tests); ++i) {
winetest_push_context("Test %u", i);
ID3D11DeviceContext_ClearRenderTargetView(test_context.immediate_context, test_context.rtv, red); todo_wine ps_code = compile_shader_flags(tests[i], "ps_4_0", D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY); if (ps_code)
Not a proper review yet, especially of patches 1 and 2, but I certainly like this patch series in principle.
Signed-off-by: Matteo Bruni mbruni@codeweavers.com