33// For the full copyright and license information, please view the LICENSE
44// file that was distributed with this source code.
55//
6- // spell-checker:ignore bincode serde utmp runlevel testusr testx boottime
6+ // spell-checker:ignore wincode serde utmp runlevel testusr testx boottime
77#![ allow( clippy:: cast_possible_wrap, clippy:: unreadable_literal) ]
88
99use uutests:: at_and_ucmd;
@@ -95,11 +95,10 @@ fn test_uptime_with_non_existent_file() {
9595) ]
9696#[ allow( clippy:: too_many_lines, clippy:: items_after_statements) ]
9797fn test_uptime_with_file_containing_valid_boot_time_utmpx_record ( ) {
98- use bincode:: { config, serde:: encode_to_vec} ;
99- use serde:: Serialize ;
100- use serde_big_array:: BigArray ;
10198 use std:: fs:: File ;
10299 use std:: { io:: Write , path:: PathBuf } ;
100+ use wincode:: serialize;
101+ use wincode_derive:: SchemaWrite ;
103102
104103 // This test will pass for freebsd but we currently don't support changing the utmpx file for
105104 // freebsd.
@@ -133,21 +132,21 @@ fn test_uptime_with_file_containing_valid_boot_time_utmpx_record() {
133132 const RUN_LVL : i32 = 1 ;
134133 const USER_PROCESS : i32 = 7 ;
135134
136- #[ derive( Serialize ) ]
135+ #[ derive( SchemaWrite ) ]
137136 #[ repr( C ) ]
138137 pub struct TimeVal {
139138 pub tv_sec : i32 ,
140139 pub tv_usec : i32 ,
141140 }
142141
143- #[ derive( Serialize ) ]
142+ #[ derive( SchemaWrite ) ]
144143 #[ repr( C ) ]
145144 pub struct ExitStatus {
146145 e_termination : i16 ,
147146 e_exit : i16 ,
148147 }
149148
150- #[ derive( Serialize ) ]
149+ #[ derive( SchemaWrite ) ]
151150 #[ repr( C , align( 4 ) ) ]
152151 pub struct Utmp {
153152 pub ut_type : i32 ,
@@ -156,7 +155,6 @@ fn test_uptime_with_file_containing_valid_boot_time_utmpx_record() {
156155 pub ut_id : [ i8 ; 4 ] ,
157156
158157 pub ut_user : [ i8 ; 32 ] ,
159- #[ serde( with = "BigArray" ) ]
160158 pub ut_host : [ i8 ; 256 ] ,
161159 pub ut_exit : ExitStatus ,
162160 pub ut_session : i32 ,
@@ -224,10 +222,9 @@ fn test_uptime_with_file_containing_valid_boot_time_utmpx_record() {
224222 glibc_reserved : [ 0 ; 20 ] ,
225223 } ;
226224
227- let config = config:: legacy ( ) ;
228- let mut buf = encode_to_vec ( utmp, config) . unwrap ( ) ;
229- buf. append ( & mut encode_to_vec ( utmp1, config) . unwrap ( ) ) ;
230- buf. append ( & mut encode_to_vec ( utmp2, config) . unwrap ( ) ) ;
225+ let mut buf = serialize ( & utmp) . unwrap ( ) ;
226+ buf. append ( & mut serialize ( & utmp1) . unwrap ( ) ) ;
227+ buf. append ( & mut serialize ( & utmp2) . unwrap ( ) ) ;
231228 let mut f = File :: create ( path) . unwrap ( ) ;
232229 f. write_all ( & buf) . unwrap ( ) ;
233230 }
0 commit comments