Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / libgo / go / debug / gosym / pclntab_test.go
index ade7043..20acba6 100644 (file)
@@ -52,6 +52,14 @@ func dotest() bool {
        return true
 }
 
+func endtest() {
+       if pclineTempDir != "" {
+               os.RemoveAll(pclineTempDir)
+               pclineTempDir = ""
+               pclinetestBinary = ""
+       }
+}
+
 func getTable(t *testing.T) *Table {
        f, tab := crack(os.Args[0], t)
        f.Close()
@@ -95,6 +103,7 @@ func TestLineFromAline(t *testing.T) {
        if !dotest() {
                return
        }
+       defer endtest()
 
        tab := getTable(t)
 
@@ -129,7 +138,7 @@ func TestLineFromAline(t *testing.T) {
                if !ok {
                        t.Errorf("file %s starts on line %d", path, line)
                } else if line != ll+1 {
-                       t.Errorf("expected next line of file %s to be %d, got %d", path, ll+1, line)
+                       t.Fatalf("expected next line of file %s to be %d, got %d", path, ll+1, line)
                }
                lastline[path] = line
        }
@@ -142,6 +151,7 @@ func TestLineAline(t *testing.T) {
        if !dotest() {
                return
        }
+       defer endtest()
 
        tab := getTable(t)
 
@@ -183,7 +193,7 @@ func TestPCLine(t *testing.T) {
        if !dotest() {
                return
        }
-       defer os.RemoveAll(pclineTempDir)
+       defer endtest()
 
        f, tab := crack(pclinetestBinary, t)
        text := f.Section(".text")