mirror of
https://github.com/danog/gllvm.git
synced 2024-12-02 12:27:47 +01:00
Some more tests.
This commit is contained in:
parent
99c9e94a5b
commit
34edd90d30
@ -56,28 +56,43 @@ func Test_more_functionality(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Test_obscure_functionality(t *testing.T) {
|
func Test_obscure_functionality(t *testing.T) {
|
||||||
|
sourceFile := "../data/helloworld.c"
|
||||||
objectFile := "../data/bhello.notanextensionthatwerecognize"
|
objectFile := "../data/bhello.notanextensionthatwerecognize"
|
||||||
args := []string{"../data/helloworld.c", "-c", "-o", objectFile}
|
exeFile := "../data/bhello"
|
||||||
|
opSys := runtime.GOOS
|
||||||
|
args := []string{sourceFile, "-c", "-o", objectFile}
|
||||||
exitCode := shared.Compile(args, "clang")
|
exitCode := shared.Compile(args, "clang")
|
||||||
if exitCode != 0 {
|
if exitCode != 0 {
|
||||||
t.Errorf("Compile of %v returned %v\n", args, exitCode)
|
t.Errorf("Compile of %v returned %v\n", args, exitCode)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Compiled OK")
|
fmt.Println("Compiled OK")
|
||||||
}
|
}
|
||||||
ok, err := shared.IsObjectFileForOS(objectFile, runtime.GOOS)
|
ok, err := shared.IsObjectFileForOS(sourceFile, opSys)
|
||||||
if !ok {
|
if ok {
|
||||||
t.Errorf("isObjectFileForOS(%v, %v) = %v (err = %v)\n", objectFile, runtime.GOOS, ok, err)
|
t.Errorf("isObjectFileForOS(%v, %v) = %v\n", sourceFile, opSys, ok)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("isObjectFileForOS(%v, %v) = %v\n", objectFile, runtime.GOOS, ok)
|
fmt.Printf("isObjectFileForOS(%v, %v) = %v (err = %v)\n", sourceFile, opSys, ok, err)
|
||||||
}
|
}
|
||||||
args = []string{objectFile, "-o", "../data/bhello"}
|
ok, err = shared.IsObjectFileForOS(objectFile, opSys)
|
||||||
|
if !ok {
|
||||||
|
t.Errorf("isObjectFileForOS(%v, %v) = %v (err = %v)\n", objectFile, opSys, ok, err)
|
||||||
|
} else {
|
||||||
|
fmt.Printf("isObjectFileForOS(%v, %v) = %v\n", objectFile, opSys, ok)
|
||||||
|
}
|
||||||
|
args = []string{objectFile, "-o", exeFile}
|
||||||
exitCode = shared.Compile(args, "clang")
|
exitCode = shared.Compile(args, "clang")
|
||||||
if exitCode != 0 {
|
if exitCode != 0 {
|
||||||
t.Errorf("Compile of %v returned %v\n", args, exitCode)
|
t.Errorf("Compile of %v returned %v\n", args, exitCode)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Compiled OK")
|
fmt.Println("Compiled OK")
|
||||||
}
|
}
|
||||||
args = []string{"get-bc", "-v", "../data/bhello"}
|
ok, err = shared.IsObjectFileForOS(exeFile, opSys)
|
||||||
|
if ok {
|
||||||
|
t.Errorf("isObjectFileForOS(%v, %v) = %v\n", exeFile, opSys, ok)
|
||||||
|
} else {
|
||||||
|
fmt.Printf("isObjectFileForOS(%v, %v) = %v (err = %v)\n", exeFile, opSys, ok, err)
|
||||||
|
}
|
||||||
|
args = []string{"get-bc", "-v", exeFile}
|
||||||
exitCode = shared.Extract(args)
|
exitCode = shared.Extract(args)
|
||||||
if exitCode != 0 {
|
if exitCode != 0 {
|
||||||
t.Errorf("Extraction of %v returned %v\n", args, exitCode)
|
t.Errorf("Extraction of %v returned %v\n", args, exitCode)
|
||||||
|
Loading…
Reference in New Issue
Block a user