...

Source file src/github.com/ThalesIgnite/crypto11/skip_test.go

Documentation: github.com/ThalesIgnite/crypto11

     1  package crypto11
     2  
     3  import (
     4  	"os"
     5  	"strings"
     6  	"testing"
     7  )
     8  
     9  const skipTestEnv = "CRYPTO11_SKIP"
    10  const skipTestCert = "CERTS"
    11  const skipTestOAEPLabel = "OAEP_LABEL"
    12  const skipTestDSA = "DSA"
    13  
    14  // skipTest tests whether the CRYPTO11_SKIP environment variable contains
    15  // flagName. If so, it skips the test.
    16  func skipTest(t *testing.T, flagName string) {
    17  	if shouldSkipTest(flagName) {
    18  		t.Logf("Skipping test due to %s flag", flagName)
    19  		t.SkipNow()
    20  	}
    21  }
    22  
    23  func shouldSkipTest(flagName string) bool {
    24  	thingsToSkip := strings.Split(os.Getenv(skipTestEnv), ",")
    25  	for _, s := range thingsToSkip {
    26  		if s == flagName {
    27  			return true
    28  		}
    29  	}
    30  	return false
    31  }
    32  

View as plain text