libvirt/tests/networkxml2argvdata
Philipp Hahn 22ec60001e tests: dynamically replace dnsmasq path
The path to the dnsmasq binary can be configured while in the test data
the path is hard-coded to /usr/bin/. This break the test suite if a the
binary is located in a different location, like /usr/local/sbin/.

Replace the hard coded path in the test data by a token, which is
dynamically replaced in networkxml2argvtest with the configured path
after the test data has been loaded.

(Another option would have been to modify configure.ac to generate the
 test data during configure, but I do not know of an easy way do trick
 configure into mass-generate those test files without listing every
 single one, which I consider less flexible.)

- unit-test the unit-test:
  #include <assert.h>
  #define TEST(in,token,rep,out) { char *buf = strdup(in); assert(!replaceTokens(&buf, token, rep) && !strcmp(buf, out)); free(buf); }
  TEST("", "AA", "B", "");
  TEST("A", "AA", "B", "A");
  TEST("AA", "AA", "B", "B");
  TEST("AAA", "AA", "B", "BA");
  TEST("AA", "AA", "BB", "BB");
  TEST("AA", "AA", "BBB", "BBB");
  TEST("<AA", "AA", "B", "<B");
  TEST("<AA", "AA", "BB", "<BB");
  TEST("<AA", "AA", "BBB", "<BBB");
  TEST("AA>", "AA", "B", "B>");
  TEST("AA>", "AA", "BB", "BB>");
  TEST("AA>", "AA", "BBB", "BBB>");
  TEST("<AA>", "AA", "B", "<B>");
  TEST("<AA>", "AA", "BB", "<BB>");
  TEST("<AA>", "AA", "BBB", "<BBB>");
  TEST("<AA|AA>", "AA", "B", "<B|B>");
  TEST("<AA|AA>", "AA", "BB", "<BB|BB>");
  TEST("<AA|AA>", "AA", "BBB", "<BBB|BBB>");
  TEST("<AAAA>", "AA", "B", "<BB>");
  TEST("<AAAA>", "AA", "BB", "<BBBB>");
  TEST("<AAAA>", "AA", "BBB", "<BBBBBB>");
  TEST("AAAA>", "AA", "B", "BB>");
  TEST("AAAA>", "AA", "BB", "BBBB>");
  TEST("AAAA>", "AA", "BBB", "BBBBBB>");
  TEST("<AAAA", "AA", "B", "<BB");
  TEST("<AAAA", "AA", "BB", "<BBBB");
  TEST("<AAAA", "AA", "BBB", "<BBBBBB");
  alarm(1); /* no infinite loop */
  TEST("A", "A", "A", "A");
  TEST("AA", "A", "A", "AA");
  alarm(0);

Signed-off-by: Philipp Hahn <hahn@univention.de>
2012-02-01 17:02:45 -07:00
..
isolated-network.argv tests: dynamically replace dnsmasq path 2012-02-01 17:02:45 -07:00
isolated-network.xml
nat-network-dns-hosts.argv tests: dynamically replace dnsmasq path 2012-02-01 17:02:45 -07:00
nat-network-dns-hosts.xml network: add domain to unqualified names defined with <host> 2011-06-28 12:57:14 -04:00
nat-network-dns-srv-record-minimal.argv tests: dynamically replace dnsmasq path 2012-02-01 17:02:45 -07:00
nat-network-dns-srv-record-minimal.xml Implement DNS SRV record into the bridge driver 2012-01-02 23:05:55 +08:00
nat-network-dns-srv-record.argv tests: dynamically replace dnsmasq path 2012-02-01 17:02:45 -07:00
nat-network-dns-srv-record.xml Implement DNS SRV record into the bridge driver 2012-01-02 23:05:55 +08:00
nat-network-dns-txt-record.argv tests: dynamically replace dnsmasq path 2012-02-01 17:02:45 -07:00
nat-network-dns-txt-record.xml
nat-network.argv tests: dynamically replace dnsmasq path 2012-02-01 17:02:45 -07:00
nat-network.xml
netboot-network.argv tests: dynamically replace dnsmasq path 2012-02-01 17:02:45 -07:00
netboot-network.xml
netboot-proxy-network.argv tests: dynamically replace dnsmasq path 2012-02-01 17:02:45 -07:00
netboot-proxy-network.xml
routed-network.argv tests: dynamically replace dnsmasq path 2012-02-01 17:02:45 -07:00
routed-network.xml