Changeset 4288


Ignore:
Timestamp:
May 9, 2008, 12:18:02 PM (14 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #1026: Test programs that need the extended test data should check that it exists before starting the tests

Location:
branches/2.7-stable/src/test/net/sf/basedb/test
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.7-stable/src/test/net/sf/basedb/test/TestUtil.java

    r4249 r4288  
    2424package net.sf.basedb.test;
    2525
     26import java.io.File;
     27import java.io.FileNotFoundException;
    2628import java.io.FileWriter;
    2729import java.io.Writer;
     
    6466    Start the testing. Starts BASE and creates a SessionControl.
    6567  */
    66   public static void begin(boolean logMemoryUsage)
     68  public static void begin(boolean logMemoryUsage, boolean checkTestdata)
    6769  {
    6870    if (Application.isRunning()) return;
     
    7072    try
    7173    {
     74      if (checkTestdata)
     75      {
     76        File testdata = new File("../..", "testdata");
     77        if (!testdata.exists() && !testdata.isDirectory())
     78        {
     79          throw new FileNotFoundException("Could not find 'testdata' directory. " +
     80            "It must be located in the project root.");
     81        }
     82      }
    7283      write("++Starting BASE...");
    7384      if (logMemoryUsage)
     
    114125  public static SessionControl getSessionControl()
    115126  {
    116     if (sc == null) begin(false);
     127    if (sc == null) begin(false, true);
    117128    return sc;
    118129  }
  • branches/2.7-stable/src/test/net/sf/basedb/test/merge/Run.java

    r2815 r4288  
    5050    if (ok && (all || cmds.contains("setup")))
    5151    {
    52       TestUtil.begin(logMemoryUsage);
     52      TestUtil.begin(logMemoryUsage, false);
    5353      ok = MergeTest.run();
    5454      tests++;
  • branches/2.7-stable/src/test/net/sf/basedb/test/performance/Run.java

    r3675 r4288  
    5454
    5555    int tests = 0;
    56     TestUtil.begin(false);
     56    TestUtil.begin(false, true);
    5757    boolean ok = PrepareTest.run(user, password);
    5858    if (ok && (all || cmds.contains("raw")))
  • branches/2.7-stable/src/test/net/sf/basedb/test/roles/Run.java

    r2568 r4288  
    5050    if (ok && (all || cmds.contains("root")))
    5151    {
    52       TestUtil.begin(logMemoryUsage);
     52      TestUtil.begin(logMemoryUsage, true);
    5353      ok = RootTest.run();
    5454      tests++;
     
    5656    if (ok && (all || cmds.contains("admin")))
    5757    {
    58       TestUtil.begin(logMemoryUsage);
     58      TestUtil.begin(logMemoryUsage, true);
    5959      ok = AdminTest.run();
    6060      tests++;
     
    6262    if (ok && (all || cmds.contains("power")))
    6363    {
    64       TestUtil.begin(logMemoryUsage);
     64      TestUtil.begin(logMemoryUsage, true);
    6565      ok = PowerUserTest.run();
    6666      tests++;
     
    6868    if (ok && (all || cmds.contains("user")))
    6969    {
    70       TestUtil.begin(logMemoryUsage);
     70      TestUtil.begin(logMemoryUsage, true);
    7171      ok = UserTest.run();
    7272      tests++;
     
    7474    if (ok && (all || cmds.contains("guest")))
    7575    {
    76       TestUtil.begin(logMemoryUsage);
     76      TestUtil.begin(logMemoryUsage, true);
    7777      ok = GuestTest.run();
    7878      tests++;
Note: See TracChangeset for help on using the changeset viewer.