@@ -3629,3 +3629,53 @@ TEST(TracingFileSystemTest, TracingWorks) {
3629
3629
EXPECT_EQ (TracingFS->NumExistsCalls , 1u );
3630
3630
EXPECT_EQ (TracingFS->NumIsLocalCalls , 1u );
3631
3631
}
3632
+
3633
+ TEST (TracingFileSystemTest, PrintOutput) {
3634
+ auto InMemoryFS = makeIntrusiveRefCnt<vfs::InMemoryFileSystem>();
3635
+ auto TracingFS =
3636
+ makeIntrusiveRefCnt<vfs::TracingFileSystem>(std::move (InMemoryFS));
3637
+
3638
+ (void )TracingFS->status (" /foo" );
3639
+
3640
+ (void )TracingFS->openFileForRead (" /foo" );
3641
+ (void )TracingFS->openFileForRead (" /foo" );
3642
+
3643
+ std::error_code EC;
3644
+ (void )TracingFS->dir_begin (" /foo" , EC);
3645
+ (void )TracingFS->dir_begin (" /foo" , EC);
3646
+ (void )TracingFS->dir_begin (" /foo" , EC);
3647
+
3648
+ llvm::SmallString<128 > RealPath;
3649
+ (void )TracingFS->getRealPath (" /foo" , RealPath);
3650
+ (void )TracingFS->getRealPath (" /foo" , RealPath);
3651
+ (void )TracingFS->getRealPath (" /foo" , RealPath);
3652
+ (void )TracingFS->getRealPath (" /foo" , RealPath);
3653
+
3654
+ (void )TracingFS->exists (" /foo" );
3655
+ (void )TracingFS->exists (" /foo" );
3656
+ (void )TracingFS->exists (" /foo" );
3657
+ (void )TracingFS->exists (" /foo" );
3658
+ (void )TracingFS->exists (" /foo" );
3659
+
3660
+ bool IsLocal;
3661
+ (void )TracingFS->isLocal (" /foo" , IsLocal);
3662
+ (void )TracingFS->isLocal (" /foo" , IsLocal);
3663
+ (void )TracingFS->isLocal (" /foo" , IsLocal);
3664
+ (void )TracingFS->isLocal (" /foo" , IsLocal);
3665
+ (void )TracingFS->isLocal (" /foo" , IsLocal);
3666
+ (void )TracingFS->isLocal (" /foo" , IsLocal);
3667
+
3668
+ std::string Output;
3669
+ llvm::raw_string_ostream OS (Output);
3670
+ TracingFS->print (OS);
3671
+
3672
+ ASSERT_EQ (" TracingFileSystem\n "
3673
+ " NumStatusCalls=1\n "
3674
+ " NumOpenFileForReadCalls=2\n "
3675
+ " NumDirBeginCalls=3\n "
3676
+ " NumGetRealPathCalls=4\n "
3677
+ " NumExistsCalls=5\n "
3678
+ " NumIsLocalCalls=6\n "
3679
+ " InMemoryFileSystem\n " ,
3680
+ Output);
3681
+ }
0 commit comments