@@ -3598,6 +3598,42 @@ func TestRootfsEROFS(t *testing.T) {
35983598 spec .Annotations [boot .RootfsPrefix + "overlay" ] = config .NoOverlay .String ()
35993599
36003600 conf := testutil .TestConfig (t )
3601+ defer func () {
3602+ debugLogDir := conf .DebugLog
3603+ if len (debugLogDir ) == 0 {
3604+ t .Logf ("Can't print debug logs: conf.DebugLog not set" )
3605+ return
3606+ }
3607+ if stat , err := os .Stat (debugLogDir ); err != nil || ! stat .IsDir () {
3608+ debugLogDir = filepath .Dir (debugLogDir )
3609+ }
3610+ dirents , err := os .ReadDir (debugLogDir )
3611+ if err != nil {
3612+ t .Logf ("Failed to read debug log directory %q: %v" , debugLogDir , err )
3613+ return
3614+ }
3615+ for _ , dirent := range dirents {
3616+ if dirent .IsDir () {
3617+ continue
3618+ }
3619+ name := dirent .Name ()
3620+ if ! strings .HasSuffix (name , ".boot.txt" ) {
3621+ continue
3622+ }
3623+ logPath := filepath .Join (debugLogDir , name )
3624+ logData , err := os .ReadFile (logPath )
3625+ if err != nil {
3626+ t .Logf ("Failed to read debug log %q: %v" , logPath , err )
3627+ continue
3628+ }
3629+ t .Logf ("XXX debug log %q START" , logPath )
3630+ scanner := bufio .NewScanner (bytes .NewReader (logData ))
3631+ for scanner .Scan () {
3632+ t .Logf ("%s" , scanner .Text ())
3633+ }
3634+ t .Logf ("XXX debug log %q END" , logPath )
3635+ }
3636+ }()
36013637
36023638 for _ , mounts := range [][]specs.Mount {
36033639 // Case 1: EROFS rootfs without any other gofer mount.
0 commit comments