@@ -22,11 +22,11 @@ static void test_policy(const ImagePolicy *p, const char *name) {
2222
2323 printf ("%s\n" , ansi_normal ());
2424
25- assert_se (image_policy_from_string (as_string , & parsed ) >= 0 );
25+ assert_se (image_policy_from_string (as_string , /* graceful= */ false, & parsed ) >= 0 );
2626 assert_se (image_policy_equal (p , parsed ));
2727 parsed = image_policy_free (parsed );
2828
29- assert_se (image_policy_from_string (as_string_simplified , & parsed ) >= 0 );
29+ assert_se (image_policy_from_string (as_string_simplified , /* graceful= */ false, & parsed ) >= 0 );
3030 assert_se (image_policy_equivalent (p , parsed ));
3131 parsed = image_policy_free (parsed );
3232
@@ -55,14 +55,14 @@ static void test_policy(const ImagePolicy *p, const char *name) {
5555static void test_policy_string (const char * t ) {
5656 _cleanup_free_ ImagePolicy * parsed = NULL ;
5757
58- assert_se (image_policy_from_string (t , & parsed ) >= 0 );
58+ assert_se (image_policy_from_string (t , /* graceful= */ false, & parsed ) >= 0 );
5959 test_policy (parsed , t );
6060}
6161
6262static void test_policy_equiv (const char * s , bool (* func )(const ImagePolicy * p )) {
6363 _cleanup_ (image_policy_freep ) ImagePolicy * p = NULL ;
6464
65- assert_se (image_policy_from_string (s , & p ) >= 0 );
65+ assert_se (image_policy_from_string (s , /* graceful= */ false, & p ) >= 0 );
6666
6767 assert_se (func (p ));
6868 assert_se (func == image_policy_equiv_ignore || !image_policy_equiv_ignore (p ));
@@ -106,15 +106,25 @@ TEST_RET(test_image_policy_to_string) {
106106 test_policy_equiv ("=unused+absent" , image_policy_equiv_ignore );
107107 test_policy_equiv ("root=ignore:=ignore" , image_policy_equiv_ignore );
108108
109- assert_se (image_policy_from_string ("pfft" , NULL ) == - EINVAL );
110- assert_se (image_policy_from_string ("öäüß" , NULL ) == - EINVAL );
111- assert_se (image_policy_from_string (":" , NULL ) == - EINVAL );
112- assert_se (image_policy_from_string ("a=" , NULL ) == - EBADSLT );
113- assert_se (image_policy_from_string ("=a" , NULL ) == - EBADRQC );
114- assert_se (image_policy_from_string ("==" , NULL ) == - EBADRQC );
115- assert_se (image_policy_from_string ("root=verity:root=encrypted" , NULL ) == - ENOTUNIQ );
116- assert_se (image_policy_from_string ("root=grbl" , NULL ) == - EBADRQC );
117- assert_se (image_policy_from_string ("wowza=grbl" , NULL ) == - EBADSLT );
109+ assert_se (image_policy_from_string ("pfft" , /* graceful= */ false, NULL ) == - EINVAL );
110+ assert_se (image_policy_from_string ("öäüß" , /* graceful= */ false, NULL ) == - EINVAL );
111+ assert_se (image_policy_from_string (":" , /* graceful= */ false, NULL ) == - EINVAL );
112+ assert_se (image_policy_from_string ("a=" , /* graceful= */ false, NULL ) == - EBADSLT );
113+ assert_se (image_policy_from_string ("=a" , /* graceful= */ false, NULL ) == - EBADRQC );
114+ assert_se (image_policy_from_string ("==" , /* graceful= */ false, NULL ) == - EBADRQC );
115+ assert_se (image_policy_from_string ("root=verity:root=encrypted" , /* graceful= */ false, NULL ) == - ENOTUNIQ );
116+ assert_se (image_policy_from_string ("root=grbl" , /* graceful= */ false, NULL ) == - EBADRQC );
117+ assert_se (image_policy_from_string ("wowza=grbl" , /* graceful= */ false, NULL ) == - EBADSLT );
118+
119+ assert_se (image_policy_from_string ("pfft" , /* graceful= */ true, NULL ) == - EINVAL );
120+ assert_se (image_policy_from_string ("öäüß" , /* graceful= */ true, NULL ) == - EINVAL );
121+ assert_se (image_policy_from_string (":" , /* graceful= */ true, NULL ) == - EINVAL );
122+ assert_se (image_policy_from_string ("a=" , /* graceful= */ true, NULL ) == 0 );
123+ assert_se (image_policy_from_string ("=a" , /* graceful= */ true, NULL ) == 0 );
124+ assert_se (image_policy_from_string ("==" , /* graceful= */ true, NULL ) == 0 );
125+ assert_se (image_policy_from_string ("root=verity:root=encrypted" , /* graceful= */ true, NULL ) == - ENOTUNIQ );
126+ assert_se (image_policy_from_string ("root=grbl" , /* graceful= */ true, NULL ) == 0 );
127+ assert_se (image_policy_from_string ("wowza=grbl" , /* graceful= */ true, NULL ) == 0 );
118128
119129 return 0 ;
120130}
@@ -131,9 +141,9 @@ TEST(extend) {
131141static void test_policy_intersect_one (const char * a , const char * b , const char * c ) {
132142 _cleanup_ (image_policy_freep ) ImagePolicy * x = NULL , * y = NULL , * z = NULL , * t = NULL ;
133143
134- assert_se (image_policy_from_string (a , & x ) >= 0 );
135- assert_se (image_policy_from_string (b , & y ) >= 0 );
136- assert_se (image_policy_from_string (c , & z ) >= 0 );
144+ assert_se (image_policy_from_string (a , /* graceful= */ false, & x ) >= 0 );
145+ assert_se (image_policy_from_string (b , /* graceful= */ false, & y ) >= 0 );
146+ assert_se (image_policy_from_string (c , /* graceful= */ false, & z ) >= 0 );
137147
138148 assert_se (image_policy_intersect (x , y , & t ) >= 0 );
139149
@@ -163,8 +173,8 @@ TEST(image_policy_intersect) {
163173static void test_policy_ignore_designators_one (const char * a , const PartitionDesignator array [], size_t n , const char * b ) {
164174 _cleanup_ (image_policy_freep ) ImagePolicy * x = NULL , * y = NULL , * t = NULL ;
165175
166- ASSERT_OK (image_policy_from_string (a , & x ));
167- ASSERT_OK (image_policy_from_string (b , & y ));
176+ ASSERT_OK (image_policy_from_string (a , /* graceful= */ false, & x ));
177+ ASSERT_OK (image_policy_from_string (b , /* graceful= */ false, & y ));
168178
169179 _cleanup_free_ char * s1 = NULL , * s2 = NULL , * s3 = NULL ;
170180 ASSERT_OK (image_policy_to_string (x , true, & s1 ));
0 commit comments