func CreateAndRunSawScript()

in SAW/proof/common/utility.go [45:63]


func CreateAndRunSawScript(path_to_template string, placeholder_key string, value int, wg *sync.WaitGroup) {
	log.Printf("Start creating saw script for target value %s based on template %s.", value, path_to_template)
	// Create a new saw script.
	file_name := fmt.Sprint(value, ".saw")
	file, err := os.Create(file_name)
	CheckError(err)
	// Read file content of verification template.
	content, err := ioutil.ReadFile(path_to_template)
	CheckError(err)
	verification_template := string(content)
	// Replace some placeholders of the file content with target values.
	text := strings.Replace(verification_template, placeholder_key, strconv.Itoa(value), 1)
	defer file.Close()
	file.WriteString(text)
	defer os.Remove(file_name)
	// Run saw script.
	defer wg.Done()
	RunSelectCheckScript(file_name, path_to_template)
}