Uploaded image for project: 'Qt Design Studio'
  1. Qt Design Studio
  2. QDS-11710

test that crash traces for the puppet work at sentry

    XMLWordPrintable

Details

    • QDS Berlin - 2024 Week 29/30, QDS Berlin - 2024 Week 31/32, QDS Berlin - 2024 Week 33/34, QDS Berlin - 2024 Week 35/36, QDS Berlin - 2024 Week 37/38, QDS Berlin - 2024 Week 39/40, QDS Berlin - 2024 Week 41/42

    Description

      Add environment variable CRASH_PUPPET_BETTWEEN_SECONDS

      void crash() {
          int *ptr = nullptr;
          *ptr = 42; // boom
      }
      
      void setupCrashTimer() {
          // Umgebungsvariable auslesen
          bool ok;
          int crashTimeApprox = qEnvironmentVariableIntValue("CRASH_PUPPET_APPROXIMATE_SECONDS", &ok);
          if (!ok)
              return;
      
          // use random time, so not all puppets are crashing at the same time
          std::srand(std::time(nullptr) + QCoreApplication::applicationPid());
          int randomOffset = std::rand() % 10;
          int crashTime = crashTimeApprox + randomOffset;
      
          QTimer::singleShot(crashTime * 1000, QCoreApplication::instance(), &crash);
      }
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          setupCrashTimer();
      
          MainWindow w;
          w.show();
          return a.exec();
      }
      
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              tjenssen Tim Jenssen
              tjenssen Tim Jenssen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes