This repository has been archived by the owner on Oct 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathautomatedTests.pl
38 lines (33 loc) · 2.2 KB
/
automatedTests.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/perl
# Demo script to automatically start project sample1 several times with
# a different set of node speeds and node densities. Note that this script
# needs severe adaptations to be used for any real-life Sinalgo project.
# Usage: Copy this script in the ROOT DIRECTORY OF YOUR SINALGO
# installation and execute it.
# Requirements: A working perl installation, e.g. download from http://www.perl.org/
# Hints: If you are new to perl, a good starting point may be
# http://perldoc.perl.org
use strict;
use warnings;
my $numRepetitions = 50; # Number of rounds to perform for each simulation
my $refreshRate = 10; # Refresh rate
my @failureDetectionModelSuccessRate = (-1.0, 0.95, 1.0);
my @numNodesList = (36, 49, 64, 81, 100);
for my $numNodes (@numNodesList) {
for my $detectionRate (@failureDetectionModelSuccessRate) {
for (my $i = 0; $i < $numRepetitions; $i += 1) {
print("Nodes: $numNodes. Failure detection rate: $detectionRate. Test #$i\n");
die "Terminated prematurely" unless
system("./gradlew run -PappArgs=\"[" .
"'-project', 'wsn', " . # choose the project
"'-gen', '$numNodes', 'wsn:SensorNode', 'wsn:ListBasedPositionModel', 'NoMobility', " . # generate nodes
"'-gen', '1', 'wsn:SinkNode', 'wsn:ListBasedPositionModel', 'NoMobility', " . # generate nodes
"'-overwrite', 'failureDetectionModelSuccessRate=$detectionRate', " . # Detection rate
"'exitOnTerminationInGUI=true', " . # Close GUI when hasTerminated() returns true
"'outputToConsole=false', " . # Create a framework log-file for each run
"'-refreshRate', '$refreshRate', " . # Don't draw GUI often
"'-batch']\" > ~/saida-rssf/sim\\ $numNodes\\ $detectionRate\\ $i.txt" # Use batch
) == 0;
}
}
}