Commit e3a738b1 authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

reg/tests: Pass __FILE__ from the caller so the correct filename is shown in error logs.

parent 0e4172a0
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#define TODO_REG_SIZE (0x0002u) #define TODO_REG_SIZE (0x0002u)
#define TODO_REG_DATA (0x0004u) #define TODO_REG_DATA (0x0004u)
BOOL run_reg_exe_(unsigned line, const char *cmd, DWORD *rc) BOOL run_reg_exe_(const char *file, unsigned line, const char *cmd, DWORD *rc)
{ {
STARTUPINFOA si = {sizeof(STARTUPINFOA)}; STARTUPINFOA si = {sizeof(STARTUPINFOA)};
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
...@@ -51,8 +51,8 @@ BOOL run_reg_exe_(unsigned line, const char *cmd, DWORD *rc) ...@@ -51,8 +51,8 @@ BOOL run_reg_exe_(unsigned line, const char *cmd, DWORD *rc)
return bret; return bret;
} }
void verify_reg_(unsigned line, HKEY hkey, const char* value, DWORD exp_type, void verify_reg_(const char *file, unsigned line, HKEY hkey, const char *value,
const void *exp_data, DWORD exp_size, DWORD todo) DWORD exp_type, const void *exp_data, DWORD exp_size, DWORD todo)
{ {
DWORD type, size; DWORD type, size;
BYTE data[256]; BYTE data[256];
...@@ -76,7 +76,7 @@ void verify_reg_(unsigned line, HKEY hkey, const char* value, DWORD exp_type, ...@@ -76,7 +76,7 @@ void verify_reg_(unsigned line, HKEY hkey, const char* value, DWORD exp_type,
} }
} }
void verify_reg_nonexist_(unsigned line, HKEY hkey, const char *value) void verify_reg_nonexist_(const char *file, unsigned line, HKEY hkey, const char *value)
{ {
LONG err; LONG err;
...@@ -85,7 +85,8 @@ void verify_reg_nonexist_(unsigned line, HKEY hkey, const char *value) ...@@ -85,7 +85,8 @@ void verify_reg_nonexist_(unsigned line, HKEY hkey, const char *value)
(value && *value) ? value : "(Default)", err); (value && *value) ? value : "(Default)", err);
} }
void open_key_(unsigned line, const HKEY base, const char *path, const DWORD sam, HKEY *hkey) void open_key_(const char *file, unsigned line, const HKEY base, const char *path,
const DWORD sam, HKEY *hkey)
{ {
LONG err; LONG err;
...@@ -93,7 +94,7 @@ void open_key_(unsigned line, const HKEY base, const char *path, const DWORD sam ...@@ -93,7 +94,7 @@ void open_key_(unsigned line, const HKEY base, const char *path, const DWORD sam
lok(err == ERROR_SUCCESS, "RegOpenKeyExA failed: %d\n", err); lok(err == ERROR_SUCCESS, "RegOpenKeyExA failed: %d\n", err);
} }
void close_key_(unsigned line, HKEY hkey) void close_key_(const char *file, unsigned line, HKEY hkey)
{ {
LONG err; LONG err;
...@@ -101,7 +102,7 @@ void close_key_(unsigned line, HKEY hkey) ...@@ -101,7 +102,7 @@ void close_key_(unsigned line, HKEY hkey)
lok(err == ERROR_SUCCESS, "RegCloseKey failed: %d\n", err); lok(err == ERROR_SUCCESS, "RegCloseKey failed: %d\n", err);
} }
void verify_key_(unsigned line, HKEY key_base, const char *subkey) void verify_key_(const char *file, unsigned line, HKEY key_base, const char *subkey)
{ {
HKEY hkey; HKEY hkey;
LONG err; LONG err;
...@@ -113,7 +114,7 @@ void verify_key_(unsigned line, HKEY key_base, const char *subkey) ...@@ -113,7 +114,7 @@ void verify_key_(unsigned line, HKEY key_base, const char *subkey)
RegCloseKey(hkey); RegCloseKey(hkey);
} }
void verify_key_nonexist_(unsigned line, HKEY key_base, const char *subkey) void verify_key_nonexist_(const char *file, unsigned line, HKEY key_base, const char *subkey)
{ {
HKEY hkey; HKEY hkey;
LONG err; LONG err;
...@@ -126,7 +127,7 @@ void verify_key_nonexist_(unsigned line, HKEY key_base, const char *subkey) ...@@ -126,7 +127,7 @@ void verify_key_nonexist_(unsigned line, HKEY key_base, const char *subkey)
RegCloseKey(hkey); RegCloseKey(hkey);
} }
void add_key_(unsigned line, const HKEY hkey, const char *path, HKEY *subkey) void add_key_(const char *file, unsigned line, const HKEY hkey, const char *path, HKEY *subkey)
{ {
LONG err; LONG err;
...@@ -135,7 +136,7 @@ void add_key_(unsigned line, const HKEY hkey, const char *path, HKEY *subkey) ...@@ -135,7 +136,7 @@ void add_key_(unsigned line, const HKEY hkey, const char *path, HKEY *subkey)
lok(err == ERROR_SUCCESS, "RegCreateKeyExA failed: %d\n", err); lok(err == ERROR_SUCCESS, "RegCreateKeyExA failed: %d\n", err);
} }
void delete_key_(unsigned line, const HKEY hkey, const char *path) void delete_key_(const char *file, unsigned line, const HKEY hkey, const char *path)
{ {
if (path && *path) if (path && *path)
{ {
...@@ -188,7 +189,8 @@ cleanup: ...@@ -188,7 +189,8 @@ cleanup:
return ret; return ret;
} }
void add_value_(unsigned line, HKEY hkey, const char *name, DWORD type, const void *data, size_t size) void add_value_(const char *file, unsigned line, HKEY hkey, const char *name,
DWORD type, const void *data, size_t size)
{ {
LONG err; LONG err;
...@@ -196,7 +198,7 @@ void add_value_(unsigned line, HKEY hkey, const char *name, DWORD type, const vo ...@@ -196,7 +198,7 @@ void add_value_(unsigned line, HKEY hkey, const char *name, DWORD type, const vo
lok(err == ERROR_SUCCESS, "RegSetValueExA failed: %d\n", err); lok(err == ERROR_SUCCESS, "RegSetValueExA failed: %d\n", err);
} }
void delete_value_(unsigned line, const HKEY hkey, const char *name) void delete_value_(const char *file, unsigned line, const HKEY hkey, const char *name)
{ {
LONG err; LONG err;
......
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
#define TODO_REG_COMPARE (0x0008u) #define TODO_REG_COMPARE (0x0008u)
#define compare_export(f,e,todo) compare_export_(__LINE__,f,e,todo) #define compare_export(f,e,todo) compare_export_(__FILE__,__LINE__,f,e,todo)
static BOOL compare_export_(unsigned line, const char *filename, const char *expected, DWORD todo) static BOOL compare_export_(const char *file, unsigned line, const char *filename,
const char *expected, DWORD todo)
{ {
FILE *fp; FILE *fp;
long file_size; long file_size;
......
...@@ -37,7 +37,7 @@ static BOOL write_file(const void *str, DWORD size) ...@@ -37,7 +37,7 @@ static BOOL write_file(const void *str, DWORD size)
return ret; return ret;
} }
BOOL import_reg(unsigned line, const char *contents, BOOL unicode, DWORD *rc) BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unicode, DWORD *rc)
{ {
int lenA; int lenA;
BOOL ret; BOOL ret;
......
...@@ -24,52 +24,54 @@ ...@@ -24,52 +24,54 @@
#include "wine/test.h" #include "wine/test.h"
/* Common #defines */ /* Common #defines */
#define lok ok_(__FILE__,line) #define lok ok_(file,line)
#define KEY_WINE "Software\\Wine" #define KEY_WINE "Software\\Wine"
#define KEY_BASE KEY_WINE "\\reg_test" #define KEY_BASE KEY_WINE "\\reg_test"
#define REG_EXIT_SUCCESS 0 #define REG_EXIT_SUCCESS 0
#define REG_EXIT_FAILURE 1 #define REG_EXIT_FAILURE 1
/* add.c */ /* add.c */
#define run_reg_exe(c,r) run_reg_exe_(__LINE__,c,r) #define run_reg_exe(c,r) run_reg_exe_(__FILE__,__LINE__,c,r)
BOOL run_reg_exe_(unsigned line, const char *cmd, DWORD *rc); BOOL run_reg_exe_(const char *file, unsigned line, const char *cmd, DWORD *rc);
#define verify_reg(k,v,t,d,s,todo) verify_reg_(__LINE__,k,v,t,d,s,todo) #define verify_reg(k,v,t,d,s,todo) verify_reg_(__FILE__,__LINE__,k,v,t,d,s,todo)
void verify_reg_(unsigned line, HKEY hkey, const char* value, DWORD exp_type, void verify_reg_(const char *file, unsigned line, HKEY hkey, const char *value,
const void *exp_data, DWORD exp_size, DWORD todo); DWORD exp_type, const void *exp_data, DWORD exp_size, DWORD todo);
#define verify_reg_nonexist(k,v) verify_reg_nonexist_(__LINE__,k,v) #define verify_reg_nonexist(k,v) verify_reg_nonexist_(__FILE__,__LINE__,k,v)
void verify_reg_nonexist_(unsigned line, HKEY hkey, const char *value); void verify_reg_nonexist_(const char *file, unsigned line, HKEY hkey, const char *value);
#define open_key(b,p,s,k) open_key_(__LINE__,b,p,s,k) #define open_key(b,p,s,k) open_key_(__FILE__,__LINE__,b,p,s,k)
void open_key_(unsigned line, const HKEY base, const char *path, const DWORD sam, HKEY *hkey); void open_key_(const char *file, unsigned line, const HKEY base, const char *path,
const DWORD sam, HKEY *hkey);
#define close_key(k) close_key_(__LINE__,k) #define close_key(k) close_key_(__FILE__,__LINE__,k)
void close_key_(unsigned line, HKEY hkey); void close_key_(const char *file, unsigned line, HKEY hkey);
#define verify_key(k,s) verify_key_(__LINE__,k,s) #define verify_key(k,s) verify_key_(__FILE__,__LINE__,k,s)
void verify_key_(unsigned line, HKEY key_base, const char *subkey); void verify_key_(const char *file, unsigned line, HKEY key_base, const char *subkey);
#define verify_key_nonexist(k,s) verify_key_nonexist_(__LINE__,k,s) #define verify_key_nonexist(k,s) verify_key_nonexist_(__FILE__,__LINE__,k,s)
void verify_key_nonexist_(unsigned line, HKEY key_base, const char *subkey); void verify_key_nonexist_(const char *file, unsigned line, HKEY key_base, const char *subkey);
#define add_key(k,p,s) add_key_(__LINE__,k,p,s) #define add_key(k,p,s) add_key_(__FILE__,__LINE__,k,p,s)
void add_key_(unsigned line, const HKEY hkey, const char *path, HKEY *subkey); void add_key_(const char *file, unsigned line, const HKEY hkey, const char *path, HKEY *subkey);
#define delete_key(k,p) delete_key_(__LINE__,k,p) #define delete_key(k,p) delete_key_(__FILE__,__LINE__,k,p)
void delete_key_(unsigned line, const HKEY hkey, const char *path); void delete_key_(const char *file, unsigned line, const HKEY hkey, const char *path);
LONG delete_tree(const HKEY key, const char *subkey); LONG delete_tree(const HKEY key, const char *subkey);
#define add_value(k,n,t,d,s) add_value_(__LINE__,k,n,t,d,s) #define add_value(k,n,t,d,s) add_value_(__FILE__,__LINE__,k,n,t,d,s)
void add_value_(unsigned line, HKEY hkey, const char *name, DWORD type, const void *data, size_t size); void add_value_(const char *file, unsigned line, HKEY hkey, const char *name,
DWORD type, const void *data, size_t size);
#define delete_value(k,n) delete_value_(__LINE__,k,n) #define delete_value(k,n) delete_value_(__FILE__,__LINE__,k,n)
void delete_value_(unsigned line, const HKEY hkey, const char *name); void delete_value_(const char *file, unsigned line, const HKEY hkey, const char *name);
/* import.c */ /* import.c */
#define test_import_str(c,r) import_reg(__LINE__,c,FALSE,r) #define test_import_str(c,r) import_reg(__FILE__,__LINE__,c,FALSE,r)
#define test_import_wstr(c,r) import_reg(__LINE__,c,TRUE,r) #define test_import_wstr(c,r) import_reg(__FILE__,__LINE__,c,TRUE,r)
BOOL import_reg(unsigned line, const char *contents, BOOL unicode, DWORD *rc); BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unicode, DWORD *rc);
#endif /* __REG_TEST_H__ */ #endif /* __REG_TEST_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment