Uploaded image for project: 'Fabric'
  1. Fabric
  2. FAB-17148

bccsp/sw/impl_test does not cleanup temporary directories

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Medium
    • Resolution: Done
    • v2.0.0
    • v2.0.0
    • fabric-crypto
    • (Please add steps to reproduce)

    Description

      My tmpfs filled up today. When I looked in the directory, I found hundreds of directory entries like this:

      bccsp-sw012112472                                                                                                                                                                    
      bccsp-sw013888357                                                                                                                                                                    
      bccsp-sw018301977                                                                                                                                                                    
      bccsp-sw018547488                                                                                                                                                                    
      bccsp-sw025594217                                                                                                                                                                    
      bccsp-sw027997722                                                                                                                                                                    
      bccsp-sw028166357                                                                                                                                                                    
      bccsp-sw028412737                                                                                                                                                                    
      bccsp-sw032099235                                                                                                                                                                    
      bccsp-sw037743897                                                                                                                                                                    
      bccsp-sw074214301                                                                                                                                                                    
      bccsp-sw077179605                                                                                                                                                                    
      bccsp-sw115707765                                                                                                                                                                    
      bccsp-sw136555114                                                                                                                                                                    
      bccsp-sw158334336                                                                                                                                                                    
      bccsp-sw163894744                                                                                                                                                                    
      bccsp-sw180537190                                                                                                                                                                    
      bccsp-sw196812380                                                                                                                                                                    
      bccsp-sw230348096                                                                                                                                                                    
      bccsp-sw257630673                                                                                                                                                                    
      bccsp-sw270912640                                                                                                                                                                    
      bccsp-sw274183369                                                                                                                                                                    
      bccsp-sw274615136                                                                                                                                                                    
      bccsp-sw274685647                                                                                                                                                                    
      bccsp-sw280747669                                                                                                                                                                    
      bccsp-sw286267436                                                                                                                                                                    
      bccsp-sw288349854                                                                                                                                                                    
      bccsp-sw312212046                                                                                                                                                                    
      bccsp-sw370193145                                                                                                                                                                    
      bccsp-sw377809871                                                                                                                                                                    
      bccsp-sw383122108                                                                                                                                                                    
      bccsp-sw384270519                                                                                                                                                                    
      

      The bccsp tests create a temporary directory out of TestMain and rely on a defer to clean them up. Since TestMain will exit without returning, the defer will never run.

      func TestMain(m *testing.M) {
      	tests := []testConfig{
      		{256, "SHA2"},
      		{256, "SHA3"},
      		{384, "SHA2"},
      		{384, "SHA3"},
      	}
      
      	var err error
      	tempDir, err = ioutil.TempDir("", "bccsp-sw")
      	if err != nil {
      		fmt.Printf("Failed to create temporary directory: %s\n\n", err)
      		os.Exit(-1)
      	}
      	defer os.RemoveAll(tempDir)
      

      Attachments

        Activity

          People

            baidang201 Yihang Li
            sykesm Matthew Sykes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: