github.com/DARA-Project/GoDist-Scheduler@v0.0.0-20201030134746-668de4acea0d/examples/diningphilosopher_test/run.sh (about)

     1  #!/bin/bash
     2  # diningPhil/run.sh controls the exection of the dining philosophers
     3  # example diningPhilosophers runs on an arbetrary number of hosts, the
     4  # communication pattern follows Host_i-1 <--> Host_i <--> Host_i+1
     5  # That is, every host has a neighbour, and only communicates with that
     6  # neighbour
     7  
     8  Hosts=3
     9  BasePort=6000
    10  DINV=$GOPATH/src/bitbucket.org/bestchai/dinv
    11  DARA=$GOPATH/src/github.com/DARA-Project/GoDist-Scheduler
    12  testDir=$DARA/examples/diningPhil
    13  dgo=/usr/bin/dgo
    14  P1=diningphilosopher.go
    15  Original=original
    16  
    17  LOGSERVER="localhost:17000"
    18  
    19  function installDinv {
    20      echo "Install dinv"
    21      cd $DINV
    22      $dgo install
    23      cd $testDir
    24  }
    25  
    26  function runTestPrograms {
    27      cd $testDir
    28      pwd
    29      for (( i=0; i<Hosts; i++))
    30      do
    31          let "hostPort=i + BasePort"
    32          let "neighbourPort= (i+1)%Hosts + BasePort"
    33  
    34          export DINV_HOSTNAME="localhost:$hostPort"
    35          export DINV_LOG_STORE="localhost:17000"
    36          export DINV_PROJECT="phil"
    37          export DARAON=true
    38          $dgo run diningphilosopher.go -mP $hostPort -nP $neighbourPort &
    39          export DARAON=false
    40      done
    41      sleep 15
    42      kill `ps | pgrep dining | awk '{print $1}'`
    43  }
    44  
    45  function RecordExecution {
    46      cd $testDir
    47      pwd
    48      export DARAON=false
    49      $dgo build diningphilopsophers.go
    50      for i in $(seq 1 $PROCESSES)
    51      do
    52          export DINV_HOSTNAME="localhost:$hostPort"
    53          export DINV_LOG_STORE="localhost:17000"
    54          export DINV_PROJECT="phil"
    55          export DARAON=true
    56          export DARAPID=$i
    57          #record an execution
    58          export DARAON=true
    59          ./diningphilosophers 1> $Program-$DARAPID.record 2> Local-Scheduler-$DARAPID.record &
    60          export DARAON=false
    61      done
    62  }
    63  
    64  
    65  installDinv
    66  #instrument $P1
    67  runTestPrograms
    68  #runLogMerger
    69  #time runDaikon
    70  #if [ "$1" == "-d" ];
    71  #then
    72  #    exit
    73  #fi
    74  #cleanUp