src/HOL/Tools/SMT/lib/scripts/remote_smt
author blanchet
Wed, 15 Dec 2010 18:10:32 +0100
changeset 41171 043f8dc3b51f
parent 40684 c7ba327eb58c
child 41432 3214c39777ab
permissions -rwxr-xr-x
facilitate debugging
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36898
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     1
#!/usr/bin/env perl
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     2
#
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     3
# Author: Sascha Boehme, TU Muenchen
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     4
#
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     5
# Invoke remote SMT solvers.
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     6
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     7
use strict;
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     8
use warnings;
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     9
use LWP;
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    10
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    11
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    12
# arguments
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    13
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    14
my $solver = $ARGV[0];
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    15
my @options = @ARGV[1 .. ($#ARGV - 1)];
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    16
my $problem_file = $ARGV[-1];
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    17
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    18
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    19
# call solver
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    20
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    21
my $agent = LWP::UserAgent->new;
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    22
$agent->agent("SMT-Request");
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    23
$agent->timeout(180);
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    24
my $response = $agent->post($ENV{"REMOTE_SMT_URL"}, [
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    25
  "Solver" => $solver,
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    26
  "Options" => join(" ", @options),
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    27
  "Problem" => [$problem_file] ],
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    28
  "Content_Type" => "form-data");
40684
c7ba327eb58c more precise error handling in Sledgehammer/SMT for Z3 and remote SMT provers
blanchet
parents: 36898
diff changeset
    29
if (not $response->is_success) { die "HTTP error: " . $response->message; }
36898
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    30
else { print $response->content; }
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    31