src/HOL/SMT/lib/scripts/remote_smt
author boehmes
Mon, 08 Feb 2010 11:01:47 +0100
changeset 35025 0ea45a4d32f3
permissions -rwxr-xr-x
split SMT perl script: certificate caching and invokation of remote solvers are now in separate scripts,
modernized perl scripts: prefer standalone executables
boehmes@35025
     1
#!/usr/bin/env perl
boehmes@35025
     2
#
boehmes@35025
     3
# Author: Sascha Boehme, TU Muenchen
boehmes@35025
     4
#
boehmes@35025
     5
# Invoke remote SMT solvers.
boehmes@35025
     6
boehmes@35025
     7
use strict;
boehmes@35025
     8
use warnings;
boehmes@35025
     9
use LWP;
boehmes@35025
    10
boehmes@35025
    11
boehmes@35025
    12
# arguments
boehmes@35025
    13
boehmes@35025
    14
my $solver = $ARGV[0];
boehmes@35025
    15
my @options = @ARGV[1 .. ($#ARGV - 1)];
boehmes@35025
    16
my $problem_file = $ARGV[-1];
boehmes@35025
    17
boehmes@35025
    18
boehmes@35025
    19
# call solver
boehmes@35025
    20
boehmes@35025
    21
my $agent = LWP::UserAgent->new;
boehmes@35025
    22
$agent->agent("SMT-Request");
boehmes@35025
    23
$agent->timeout(180);
boehmes@35025
    24
my $response = $agent->post($ENV{"REMOTE_SMT_URL"}, [
boehmes@35025
    25
  "Solver" => $solver,
boehmes@35025
    26
  "Options" => join(" ", @options),
boehmes@35025
    27
  "Problem" => [$problem_file] ],
boehmes@35025
    28
  "Content_Type" => "form-data");
boehmes@35025
    29
if (not $response->is_success) { die "HTTP-Error: " . $response->message; }
boehmes@35025
    30
else { print $response->content; }
boehmes@35025
    31