@@ -153,6 +153,114 @@ TEST_F(convert_event_test, PPME_SYSCALL_READ_X_to_4_params_with_enter) {
153153 size));
154154}
155155
156+ // //////////////////////////
157+ // UNLINK
158+ // //////////////////////////
159+
160+ TEST_F (convert_event_test, PPME_SYSCALL_UNLINK_X_1_to_2_X_2_params_no_enter) {
161+ constexpr uint64_t ts = 12 ;
162+ constexpr int64_t tid = 25 ;
163+
164+ constexpr int64_t res = 89 ;
165+
166+ // Set to empty.
167+ constexpr auto path = empty_value<char *>();
168+
169+ SCAP_EMPTY_PARAMS_SET (empty_params_set, 1 );
170+
171+ assert_single_conversion_success (
172+ CONVERSION_COMPLETED,
173+ create_safe_scap_event (ts, tid, PPME_SYSCALL_UNLINK_X, 1 , res),
174+ create_safe_scap_event_with_empty_params (ts,
175+ tid,
176+ PPME_SYSCALL_UNLINK_2_X,
177+ &empty_params_set,
178+ 2 ,
179+ res,
180+ path));
181+ }
182+
183+ TEST_F (convert_event_test, PPME_SYSCALL_UNLINK_X_1_to_2_X_2_params_with_enter) {
184+ constexpr uint64_t ts = 12 ;
185+ constexpr int64_t tid = 25 ;
186+
187+ constexpr int64_t res = 89 ;
188+ constexpr char path[] = " /etc/ld.so.preload" ;
189+
190+ // After the first conversion we should have the storage
191+ const auto evt = create_safe_scap_event (ts, tid, PPME_SYSCALL_UNLINK_E, 1 , path);
192+ assert_single_conversion_skip (evt);
193+ assert_event_storage_presence (evt);
194+
195+ assert_single_conversion_success (
196+ CONVERSION_COMPLETED,
197+ create_safe_scap_event (ts, tid, PPME_SYSCALL_UNLINK_X, 1 , res),
198+ create_safe_scap_event (ts, tid, PPME_SYSCALL_UNLINK_2_X, 2 , res, path));
199+ }
200+
201+ // //////////////////////////
202+ // UNLINKAT
203+ // //////////////////////////
204+
205+ TEST_F (convert_event_test, PPME_SYSCALL_UNLINKAT_X_1_to_2_X_4_params_no_enter) {
206+ constexpr uint64_t ts = 12 ;
207+ constexpr int64_t tid = 25 ;
208+
209+ constexpr int64_t res = 89 ;
210+
211+ // Set to empty.
212+ constexpr auto dirfd = empty_value<int64_t >();
213+ constexpr auto name = empty_value<char *>();
214+ constexpr auto flags = empty_value<uint32_t >();
215+
216+ SCAP_EMPTY_PARAMS_SET (empty_params_set, 1 , 2 , 3 );
217+
218+ assert_single_conversion_success (
219+ CONVERSION_COMPLETED,
220+ create_safe_scap_event (ts, tid, PPME_SYSCALL_UNLINKAT_X, 1 , res),
221+ create_safe_scap_event_with_empty_params (ts,
222+ tid,
223+ PPME_SYSCALL_UNLINKAT_2_X,
224+ &empty_params_set,
225+ 4 ,
226+ res,
227+ dirfd,
228+ name,
229+ flags));
230+ }
231+
232+ TEST_F (convert_event_test, PPME_SYSCALL_UNLINKAT_X_1_to_2_X_4_params_with_enter) {
233+ constexpr uint64_t ts = 12 ;
234+ constexpr int64_t tid = 25 ;
235+
236+ constexpr int64_t res = 89 ;
237+ constexpr int64_t dirfd = 25 ;
238+ constexpr char name[] = " /etc/ld.so.preload" ;
239+
240+ // Set to empty.
241+ constexpr auto flags = empty_value<uint32_t >();
242+
243+ SCAP_EMPTY_PARAMS_SET (empty_params_set, 3 );
244+
245+ // After the first conversion we should have the storage
246+ const auto evt = create_safe_scap_event (ts, tid, PPME_SYSCALL_UNLINKAT_E, 2 , dirfd, name);
247+ assert_single_conversion_skip (evt);
248+ assert_event_storage_presence (evt);
249+
250+ assert_single_conversion_success (
251+ CONVERSION_COMPLETED,
252+ create_safe_scap_event (ts, tid, PPME_SYSCALL_UNLINKAT_X, 1 , res),
253+ create_safe_scap_event_with_empty_params (ts,
254+ tid,
255+ PPME_SYSCALL_UNLINKAT_2_X,
256+ &empty_params_set,
257+ 4 ,
258+ res,
259+ dirfd,
260+ name,
261+ flags));
262+ }
263+
156264// //////////////////////////
157265// PREAD
158266// //////////////////////////
0 commit comments