anchor.diff:          # should be assigned to testtarget1. testService3 should be assinged
           # to testtarget2. This test should succeed.
   
  -        $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-lowest-bidder.nix");
  -        @distribution = split('\n', $machine->mustSucceed("cat $result"));
  -
  -        if($distribution[5] =~ /testtarget1/) {
  -            print "line 5 contains testtarget1!\n";
  -        } else {
  -            die "line 5 should contain testtarget1!\n";
  -        }
  -
  -        if($distribution[8] =~ /testtarget1/) {
  -            print "line 8 contains testtarget1!\n";
  -        } else {
  -            die "line 8 should contain testtarget1!\n";
  -        }
  -
  -        if($distribution[11] =~ /testtarget2/) {
  -            print "line 11 contains testtarget2!\n";
  -        } else {
  -            die "line 11 should contain testtarget2!\n";
  -        }
  +        $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-lowest-bidder.nix --output-xml");
  +
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget2']\" result");
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget2']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget2']\" result");
   
           # Execute the same division method again. It should fail because the machines cannot provide its required capacity.
           $machine->mustFail("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure-undercapacity.nix -q ${tests}/qos/qos-lowest-bidder.nix");
   
           # Execute round robin division method.
  -        $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-roundrobin.nix");
  -        @distribution = split('\n', $machine->mustSucceed("cat $result"));
  -
  -        if($distribution[5] =~ /testtarget1/) {
  -            print "line 5 contains testtarget1!\n";
  -        } else {
  -            die "line 5 should contain testtarget1!\n";
  -        }
  -
  -        if($distribution[8] =~ /testtarget2/) {
  -            print "line 8 contains testtarget2!\n";
  -        } else {
  -            die "line 8 should contain testtarget2!\n";
  -        }
  -
  -        if($distribution[11] =~ /testtarget1/) {
  -            print "line 11 contains testtarget1!\n";
  -        } else {
  -            die "line 11 should contain testtarget1!\n";
  -        }
  +        $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-roundrobin.nix --output-xml");
  +
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget2']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget2']\" result");
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget2']\" result");
   
           # Execute minimum set cover approximation method, by looking to the
           # cost attribute in the infrastructure model. All services should
           # be distributed to testtarget1.
   
  -        $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-minsetcover.nix");
  -        @distribution = split('\n', $machine->mustSucceed("cat $result"));
  -
  -        if($distribution[5] =~ /testtarget1/) {
  -            print "line 5 contains testtarget1!\n";
  -        } else {
  -            die "line 5 should contain testtarget1!\n";
  -        }
  -
  -        if($distribution[8] =~ /testtarget1/) {
  -            print "line 8 contains testtarget1!\n";
  -        } else {
  -            die "line 8 should contain testtarget1!\n";
  -        }
  -
  -        if($distribution[11] =~ /testtarget1/) {
  -            print "line 11 contains testtarget1!\n";
  -        } else {
  -            die "line 11 should contain testtarget1!\n";
  -        }
  +        $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-minsetcover.nix --output-xml");
  +
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget2']\" result");
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget2']\" result");
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget2']\" result");
   
           # Execute minimum set cover approximation method, by looking to the
           # cost attribute in the infrastructure model. testService1 and
           # testService2 should be distributed to testtarget1. testService3
           # should be distributed to testtarget2.
   
  -        $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-minsetcover2.nix");
  -        @distribution = split('\n', $machine->mustSucceed("cat $result"));
  -
  -        if($distribution[5] =~ /testtarget1/) {
  -            print "line 5 contains testtarget1!\n";
  -        } else {
  -            die "line 5 should contain testtarget1!\n";
  -        }
  -
  -        if($distribution[8] =~ /testtarget1/) {
  -            print "line 8 contains testtarget1!\n";
  -        } else {
  -            die "line 8 should contain testtarget1!\n";
  -        }
  -
  -        if($distribution[11] =~ /testtarget2/) {
  -            print "line 11 contains testtarget2!\n";
  -        } else {
  -            die "line 11 should contain testtarget2!\n";
  -        }
  +        $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-minsetcover2.nix --output-xml");
  +
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget2']\" result");
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget2']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget2']\" result");
   
           # Execute multiway cut approximation method.
           # In this case all services should be mapped to testtarget1.
           # This test should succeed.
   
  -        $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-multiwaycut.nix");
  -        @distribution = split('\n', $machine->mustSucceed("cat $result"));
  -
  -        if($distribution[5] =~ /testtarget1/) {
  -            print "line 5 contains testtarget1!\n";
  -        } else {
  -            die "line 5 should contain testtarget1!\n";
  -        }
  -
  -        if($distribution[8] =~ /testtarget1/) {
  -            print "line 8 contains testtarget1!\n";
  -        } else {
  -            die "line 8 should contain testtarget1!\n";
  -        }
  -
  -        if($distribution[11] =~ /testtarget1/) {
  -            print "line 11 contains testtarget1!\n";
  -        } else {
  -            die "line 11 should contain testtarget1!\n";
  -        }
  +        $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-multiwaycut.nix --output-xml");
  +
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget2']\" result");
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget2']\" result");
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget2']\" result");
   
           # Execute graph coloring test. Each service should be mapped to a different machine.
   
  -        $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure-3.nix -q ${tests}/qos/qos-graphcol.nix");
  -        @distribution = split('\n', $machine->mustSucceed("cat $result"));
  -
  -        if($distribution[5] =~ /testtarget1/) {
  -            print "line 5 contains testtarget1!\n";
  -        } else {
  -            die "line 5 should contain testtarget1!\n";
  -        }
  -
  -        if($distribution[8] =~ /testtarget2/) {
  -            print "line 8 contains testtarget2!\n";
  -        } else {
  -            die "line 8 should contain testtarget2!\n";
  -        }
  -
  -        if($distribution[11] =~ /testtarget3/) {
  -            print "line 11 contains testtarget3!\n";
  -        } else {
  -            die "line 11 should contain testtarget3!\n";
  -        }
  +        $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure-3.nix -q ${tests}/qos/qos-graphcol.nix --output-xml");
  +
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget2']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget3']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget2']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget3']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget1']\" result");
  +        $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget2']\" result");
  +        $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget3']\" result");
   
           # Execute map stateful to previous test. First, all services are
           # mapped to testtarget1. Then an upgrade is performed in which
  
positive.code:         # targettarget1. testService3 should be assigned to testtarget2.
          # This test should succeed.
  
          $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-highest-bidder.nix");
          @distribution = split('\n', $machine->mustSucceed("cat $result"));
  
          if($distribution[5] =~ /testtarget2/) {
              print "line 5 contains testtarget2!\n";
          } else {
              die "line 5 should contain testtarget2!\n";
          }
  
          if($distribution[8] =~ /testtarget1/) {
              print "line 8 contains testtarget1!\n";
          } else {
              die "line 8 should contain testtarget1!\n";
          }
  
          if($distribution[11] =~ /testtarget2/) {
              print "line 11 contains testtarget2!\n";
          } else {
              die "line 11 should contain testtarget2!\n";
          }
  
          # Execute the same division method again. It should fail because the machines cannot provide its required capacity.
          $machine->mustFail("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure-undercapacity.nix -q ${tests}/qos/qos-highest-bidder.nix");
  
negative.code:         # occur, so all machines in the network are valid candidate hosts.
          # This test should succeed.
  
          $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist --filter-buildable -s ${tests}/services.nix -i ${tests}/infrastructure.nix --output-xml");
  
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget2']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget2']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget2']\" result");
  
          # Execute filter buildable. In this situation a build exception is
          # thrown for testService1B rendering it undeployable.
          # This test should succeed.
  
          $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist --filter-buildable -s ${tests}/services-error.nix -i ${tests}/infrastructure.nix --output-xml");
  
          $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService1B']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService1B']/mapping/target[text() = 'testtarget2']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget2']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget2']\" result");
  
          # Execute the mapAttrOnAttr method to map requireZone onto zone.
          # testService1 should be assigned to testtarget1. testService2 and
          # testService3 should be assigned to testtarget2. This test should
          # succeed.
  
          $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-mapattronattr.nix --output-xml");
  
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget2']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget2']\" result");
          $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget2']\" result");
  
          # Execute the mapAttrOnList method to map types onto supportedTypes.
          # All services must be assigned to both testtarget1 and testtarget2.
          # This test should succeed.
  
          $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-mapattronlist.nix --output-xml");
  
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget2']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget2']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget2']\" result");
  
          # Execute the mapListOnAttr method to map requiredZones onto zones.
          # testService1 must be assigned to testtarget1. testService2 must be
          # assigned to testtarget2. testService3 must be assigned to both
          # machines. This test should succeed.
  
          $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-maplistonattr.nix --output-xml");
  
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget2']\" result");
          $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget2']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget2']\" result");
  
          # Execute order. The targets are order by looking to the priority
          # attribute. The order of the targets should be reversed.
          # This test should succeed.
  
          $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-order.nix --output-xml");
  
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping[1]/target[text() = 'testtarget2']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping[2]/target[text() = 'testtarget1']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping[1]/target[text() = 'testtarget2']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping[2]/target[text() = 'testtarget1']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping[1]/target[text() = 'testtarget2']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping[2]/target[text() = 'testtarget1']\" result");
  
          # Execute the greedy division method. testService1 and testService2
          # should be assigned to testtarget2. testService3 should be assigned
          # to testtarget1. This test should succeed.
  
          $result = $machine->mustSucceed("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure.nix -q ${tests}/qos/qos-greedy.nix --output-xml");
  
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService1']/mapping/target[text() = 'testtarget2']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService2']/mapping/target[text() = 'testtarget2']\" result");
          $machine->mustFail("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget1']\" result");
          $machine->mustSucceed("xmllint --xpath \"/distribution/service[\@name='testService3']/mapping/target[text() = 'testtarget2']\" result");
  
          # Execute the same division method again. It should fail because the machines cannot provide its required capacity.
          $machine->mustFail("NIX_PATH='nixpkgs=${nixpkgs}' dydisnix-gendist -s ${tests}/services.nix -i ${tests}/infrastructure-undercapacity.nix -q ${tests}/qos/qos-greedy.nix");
  