X10
  1. X10
  2. XTENLANG-333

exit code generation bug [x10/c++ backned] - C++ regression tests dependency

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: X10 1.7.2 - C++ hosted
    • Fix Version/s: X10 1.7.3
    • Labels:
      None
    • Environment:
      All supported x10/c++ backend platforms
    • Number of attachments :
      0

      Description

      It appears that the x10/c++ compiler is not setting properly the program exit code while generating xrx pre-compiled classes –
      because of this, both execution failures and successes are simply returning 0s and consequently the regression script is failing to detect proper execution from an improper one.
      Please find all the relevant code at the end of this message.

      x10lib/harness/x10Test.x10 is setting these codes properly at the x10 application level –

      46 public const PREFIX: String = "+++++ ";
      +47
      +48 public static def success(): void =

      { +49 println(PREFIX+"Test succeeded."); +50 x10.lang.Runtime.setExitCode(0); +51 }

      +52
      +53 public static def failure(): void =

      { +54 println(PREFIX+"Test failed."); +55 x10.lang.Runtime.setExitCode(1); +56 }

      here is the xrx code that sets this (in src-x10/x10/lang/Runtime.x10) –

      +14 public value Runtime {
      +15 /**
      +16 * Sleep for the specified number of milliseconds.
      +17 * [IP] NOTE: Unlike Java, x10 sleep() simply exits when interrupted.
      +18 * @param millis the number of milliseconds to sleep
      +19 * @return true if completed normally, false if interrupted
      +20 */
      +21 public static def sleep(millis: long): boolean

      { +22 return x10.runtime.Runtime.sleep(millis); +23 }

      +24
      +25 public static def setExitCode(code: int): void

      { +26 x10.runtime.NativeRuntime.setExitCode(code); +27 }

      +28 }

      where as the generated file src-cpp/gen/x10/runtime/NativeRuntime.cc is doing nothing against this –

      +10 //#line 20 "/bench1/regress.cpp/x10.runtime.17/src-x10/x10/runtime/NativeRuntime.x10"
      +11
      +12 //#line 27 "/bench1/regress.cpp/x10.runtime.17/src-x10/x10/runtime/NativeRuntime.x10"
      +13 void x10::runtime::NativeRuntime::setExitCode(x10_int code)

      { +14 +15 }

        Issue Links

          Activity

          Hide
          David Grove added a comment -

          This isn't a compiler issue, just missing runtime implementation on the c++ side. I can fix this to let Dave C focus on c++ backend problems.

          Show
          David Grove added a comment - This isn't a compiler issue, just missing runtime implementation on the c++ side. I can fix this to let Dave C focus on c++ backend problems.
          Hide
          David Grove added a comment -

          Fixed two issues:
          (a) r7318 fixed setExitCode in Runtime.x10 to actually do something
          (b) changed MainMP.xcd so that it returns the result of template_main as the result of main.

          tested with runx10 on linux and verified return codes of 0/1 were being passed on from a test case using harness.x10Test in a way that matched the success/failure of the test case as reported by x10Test.

          Show
          David Grove added a comment - Fixed two issues: (a) r7318 fixed setExitCode in Runtime.x10 to actually do something (b) changed MainMP.xcd so that it returns the result of template_main as the result of main. tested with runx10 on linux and verified return codes of 0/1 were being passed on from a test case using harness.x10Test in a way that matched the success/failure of the test case as reported by x10Test.

            People

            • Assignee:
              David Grove
              Reporter:
              Sreedhar B Kodali
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: