Skip to content

Commit

Permalink
fix FAB-17148 defer to delete 'bccsp-sw' directory (#328)
Browse files Browse the repository at this point in the history
* fix FAB-17148 defer to delete 'bccsp-sw' directory

Signed-off-by: baidang201 <jinrishouji@sina.com>

* 1 set code = m.Run  2 delete not user 'code =0' at last line

Signed-off-by: baidang201 <jinrishouji@sina.com>
  • Loading branch information
baidang201 authored and yacovm committed Dec 1, 2019
1 parent ab4d595 commit 0264eb6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bccsp/sw/impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ func (tc testConfig) Provider(t *testing.T) (bccsp.BCCSP, bccsp.KeyStore, func()
}

func TestMain(m *testing.M) {
code := -1
defer func() {
os.Exit(code)
}()
tests := []testConfig{
{256, "SHA2"},
{256, "SHA3"},
Expand All @@ -67,19 +71,18 @@ func TestMain(m *testing.M) {
tempDir, err = ioutil.TempDir("", "bccsp-sw")
if err != nil {
fmt.Printf("Failed to create temporary directory: %s\n\n", err)
os.Exit(-1)
return
}
defer os.RemoveAll(tempDir)

for _, config := range tests {
currentTestConfig = config
ret := m.Run()
if ret != 0 {
code = m.Run()
if code != 0 {
fmt.Printf("Failed testing at [%d, %s]", config.securityLevel, config.hashFamily)
os.Exit(-1)
return
}
}
os.Exit(0)
}

func TestInvalidNewParameter(t *testing.T) {
Expand Down

0 comments on commit 0264eb6

Please sign in to comment.