Giter VIP home page Giter VIP logo

Comments (4)

ranweiler avatar ranweiler commented on May 31, 2024

I started an implementation of this, then realized that there's a problem. If you longjmp/siglongjmp from a signal handler and go on to call any non-async-signal-safe function, the result is undefined behavior. From end of signal-safety(7):

   *  If a signal handler interrupts the execution of an unsafe
      function, and the handler terminates via a call to longjmp(3) or
      siglongjmp(3) and the program subsequently calls an unsafe
      function, then the behavior of the program is undefined. 

For us, the biggest problem is that the signal we want to handle could have interrupted some (in general) async-unsafe code under test. So, if we trapped a signal from the test code, called DeepState_Fail(), and thus non-locally jumped back to the main loop of DeepState_Run(), it might corrupt some global/static state which would impact subsequent test runs. We can't get around this just by e.g. narrowly scoping when we trap the signal, trying to make all our harness code async-safe, &c.

A few options:

  1. Don't support catching signals for now.
  2. Do it anyway, perhaps making this demon-plagued behavior configurable via a flag.
  3. Fork when executing test functions with the native harness, gather results using IPC.

Option (3) probably requires some big cross-cutting changes, and might have some gotchas with respect to the executors (though we could just not fork when being run by an executor). I think (2) will lead to grief later on down the line, so I'd suggest putting this issue on hold until we can address it via (3).

from deepstate.

pgoodman avatar pgoodman commented on May 31, 2024

What about a variant of options (2) and (3). If a flag is not set, then the signal handler, upon catching the signal, prints out that the option isn't set and then promptly exits. If the flag is set, then we fork for each test, and the parent process uses waitpid, WIFSIGNALED, and WTERMSIG to check if the child was signalled.

from deepstate.

ranweiler avatar ranweiler commented on May 31, 2024

@pgoodman, I think we can close this, as it should be subsumed by the move to forking test runs in #29.

That work does not introduce any signal handler-based hooks or options, but I think that to it would be better to avoid them unless we have a really compelling use case that can't be addressed with the process-oriented test running.

from deepstate.

pgoodman avatar pgoodman commented on May 31, 2024

Sounds good :-)

from deepstate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.