@@ -31,11 +31,11 @@ bool test_cpu_profiles() {
31
31
mu_assert_eq (item -> offset , 0x00000005 , "Flag PORTB not found" );
32
32
33
33
// 3. Save into the project
34
- if (!rz_file_is_directory (".tmp" RZ_SYS_DIR )) {
35
- mu_assert_true (rz_sys_mkdir (".tmp/" ), "create tmp directory" );
36
- }
37
- RzProjectErr err = rz_project_save_file (core , ".tmp/cpu_profile.rzdb" , true);
34
+ char * tmpdir = rz_file_tmpdir ();
35
+ char * project_file = rz_file_path_join (tmpdir , "cpu_profile.rzdb" );
36
+ RzProjectErr err = rz_project_save_file (core , project_file , true);
38
37
mu_assert_eq (err , RZ_PROJECT_ERR_SUCCESS , "project save err" );
38
+ free (project_file );
39
39
40
40
// 4. Close the file
41
41
rz_core_file_close (file );
@@ -48,7 +48,9 @@ bool test_cpu_profiles() {
48
48
// 6. Load the previously saved project
49
49
RzSerializeResultInfo * res = rz_serialize_result_info_new ();
50
50
mu_assert_notnull (res , "result info new" );
51
- err = rz_project_load_file (core , ".tmp/cpu_profile.rzdb" , true, res );
51
+ project_file = rz_file_path_join (tmpdir , "cpu_profile.rzdb" );
52
+ err = rz_project_load_file (core , project_file , true, res );
53
+ free (project_file );
52
54
rz_serialize_result_info_free (res );
53
55
mu_assert_eq (err , RZ_PROJECT_ERR_SUCCESS , "project load err" );
54
56
@@ -58,6 +60,7 @@ bool test_cpu_profiles() {
58
60
item = rz_flag_get (core -> flags , "PORTB" );
59
61
mu_assert_eq (item -> offset , 0x00000005 , "Flag PORTB not found" );
60
62
63
+ free (tmpdir );
61
64
rz_core_free (core );
62
65
mu_end ;
63
66
}
@@ -85,8 +88,11 @@ bool test_platform_profiles() {
85
88
mu_assert_streq (comment , "Broadcom Serial Controller 1 (BSC)" , "Comment unequal!" );
86
89
87
90
// 3. Save into the project
88
- RzProjectErr err = rz_project_save_file (core , ".tmp/cpu_platform.rzdb" , true);
91
+ char * tmpdir = rz_file_tmpdir ();
92
+ char * project_file = rz_file_path_join (tmpdir , "cpu_platform.rzdb" );
93
+ RzProjectErr err = rz_project_save_file (core , project_file , true);
89
94
mu_assert_eq (err , RZ_PROJECT_ERR_SUCCESS , "project save err" );
95
+ free (project_file );
90
96
91
97
// 4. Close the file
92
98
rz_core_file_close (file );
@@ -99,7 +105,9 @@ bool test_platform_profiles() {
99
105
// 6. Load the previously saved project
100
106
RzSerializeResultInfo * res = rz_serialize_result_info_new ();
101
107
mu_assert_notnull (res , "result info new" );
102
- err = rz_project_load_file (core , ".tmp/cpu_platform.rzdb" , true, res );
108
+ project_file = rz_file_path_join (tmpdir , "cpu_platform.rzdb" );
109
+ err = rz_project_load_file (core , project_file , true, res );
110
+ free (project_file );
103
111
rz_serialize_result_info_free (res );
104
112
mu_assert_eq (err , RZ_PROJECT_ERR_SUCCESS , "project load err" );
105
113
@@ -109,6 +117,7 @@ bool test_platform_profiles() {
109
117
item = rz_flag_get (core -> flags , "AUX_MU_IER_REG" );
110
118
mu_assert_eq (item -> offset , 0x7e215044 , "Flag AUX_MU_IER_REG not found" );
111
119
120
+ free (tmpdir );
112
121
rz_core_free (core );
113
122
mu_end ;
114
123
}
0 commit comments