Class SysGlobals

java.lang.Object
com.carrotsearch.randomizedtesting.SysGlobals

public final class SysGlobals extends Object
Global names for system properties controlling the behavior of JUnit4 ANT task and RandomizedRunner.
  • Field Details

    • CHILDVM_SYSPROP_JVM_ID

      public static final String CHILDVM_SYSPROP_JVM_ID
      System property passed to forked VMs: VM ID (sequential integer between 0 and the (number of concurrent jvms - 1)).
      See Also:
    • CHILDVM_SYSPROP_JVM_COUNT

      public static final String CHILDVM_SYSPROP_JVM_COUNT
      System property passed to forked VMs: the number of concurrent JVMs.
      See Also:
    • lock

      private static final Object lock
    • DEFAULT_PREFIX

      private static final String DEFAULT_PREFIX
      Default prefix for all properties.
      See Also:
    • SYSPROP_PREFIX

      private static final String SYSPROP_PREFIX
      A common prefix for all system properties used by randomizedtesting packages. It is discouraged to change this property but it may be used to resolve conflicts with packages that have overlapping property names.
      See Also:
    • singleton

      private static SysGlobals singleton
      Global singleton. Initialized once.
    • singletonInitStack

      private static StackTraceElement[] singletonInitStack
      Singleton initialization stack for easier debugging.
    • prefix

      private final String prefix
      Initialized singleton's prefix.
    • SYSPROP_STACKFILTERING

      private final String SYSPROP_STACKFILTERING
    • SYSPROP_RANDOM_SEED

      private final String SYSPROP_RANDOM_SEED
    • SYSPROP_ITERATIONS

      private final String SYSPROP_ITERATIONS
    • SYSPROP_TESTCLASS

      private final String SYSPROP_TESTCLASS
    • SYSPROP_TESTMETHOD

      private final String SYSPROP_TESTMETHOD
    • SYSPROP_TESTFILTER

      private final String SYSPROP_TESTFILTER
    • SYSPROP_KILLATTEMPTS

      private final String SYSPROP_KILLATTEMPTS
    • SYSPROP_KILLWAIT

      private final String SYSPROP_KILLWAIT
    • SYSPROP_TIMEOUT

      private final String SYSPROP_TIMEOUT
    • SYSPROP_TIMEOUT_SUITE

      private final String SYSPROP_TIMEOUT_SUITE
    • SYSPROP_APPEND_SEED

      private final String SYSPROP_APPEND_SEED
    • SYSPROP_ASSERTS

      private final String SYSPROP_ASSERTS
  • Constructor Details

    • SysGlobals

      private SysGlobals(String prefix)
  • Method Details

    • prefixWith

      private String prefixWith(String prefix, String propertyName)
    • singleton

      private static SysGlobals singleton()
    • initializeWith

      public static SysGlobals initializeWith(String prefix)
    • SYSPROP_PREFIX

      public static String SYSPROP_PREFIX()
      Global system property that holds the prefix used by other properties.
    • CURRENT_PREFIX

      public static String CURRENT_PREFIX()
      Static singleton's property prefix. Initializes it if not already initialized.
    • SYSPROP_STACKFILTERING

      public static String SYSPROP_STACKFILTERING()
      Enable or disable stack filtering.
    • SYSPROP_RANDOM_SEED

      public static String SYSPROP_RANDOM_SEED()
      System property with an integer defining global initialization seeds for all random generators. Should guarantee test reproducibility.
    • SYSPROP_ITERATIONS

      public static String SYSPROP_ITERATIONS()
      The global override for the number of each test's repetitions.
    • SYSPROP_TESTCLASS

      public static String SYSPROP_TESTCLASS()
      Global override for picking out a single test class to execute. All other classes are ignored. The property can contain "globbing patterns" similar to shell expansion patterns. For example:
       *MyTest
       
      will pick all classes ending in MyTest (in any package, including nested static classes if they appear on input).
    • SYSPROP_TESTMETHOD

      public static String SYSPROP_TESTMETHOD()
      Global override for picking out a single test method to execute. If a matching method exists in more than one class, it will be executed.
    • SYSPROP_TESTFILTER

      public static String SYSPROP_TESTFILTER()
      Global test filter.
    • SYSPROP_KILLATTEMPTS

      public static String SYSPROP_KILLATTEMPTS()
      If there's a runaway thread, how many times do we try to interrupt and then kill it before we give up? Runaway threads may affect other tests (bad idea).
    • SYSPROP_KILLWAIT

      public static String SYSPROP_KILLWAIT()
      If there's a runaway thread, how long should we wait between iterations of putting a silver bullet through its heart?
    • SYSPROP_TIMEOUT

      public static String SYSPROP_TIMEOUT()
      Global override for a single test case's maximum execution time after which it is considered out of control and an attempt to interrupt it is executed.

      The timeout value should be in milliseconds. If the value is trailed by a "!" then the timeout value takes precedence over annotations, otherwise annotations take precedence over the default timeout. This is useful for running debugging sessions, for example, when default timeouts may be too short.

      See Also:
    • SYSPROP_TIMEOUT_SUITE

      public static String SYSPROP_TIMEOUT_SUITE()
      Global override for entire suite's maximum execution time after which it is considered out of control.

      The timeout value should be in milliseconds. If the value is trailed by a "!" then the timeout value takes precedence over annotations, otherwise annotations take precedence over the default timeout. This is useful for running debugging sessions, for example, when default timeouts may be too short.

      See Also:
    • SYSPROP_APPEND_SEED

      public static String SYSPROP_APPEND_SEED()
      If true, append seed parameter to all methods. Methods that are for some reason repeated (due to Repeat annotation or multiple Seeds, for example) are always postfixed with the seed to discriminate tests from each other. Otherwise many GUI clients have a problem in telling which test result was which.
    • SYSPROP_ASSERTS

      public static String SYSPROP_ASSERTS()
      Returns the property name to express the desired status of assertions during tests.
      See Also:
    • prefixProperty

      public static String prefixProperty(String propertyName)
      Prefix a given property name with a common prefix. The prefix itself can be overridden using SYSPROP_PREFIX. This method initializes static singleton property names so it shouldn't be called on class initialization anywhere.