text: # Copyright 2016-2022 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
  # ReFrame Project Developers. See the top-level LICENSE file for details.
  #
  # SPDX-License-Identifier: BSD-3-Clause
  
  # rfmdocstart: hellothreaded
  import reframe as rfm
  import reframe.utility.sanity as sn
  
  
  @rfm.simple_test
  class HelloThreadedTest(rfm.RegressionTest):
      valid_systems = ['*']
      valid_prog_environs = ['*']
      sourcepath = 'hello_threads.cpp'
      build_system = 'SingleSource'
      executable_opts = ['16']
  
      @run_before('compile')
      def set_compilation_flags(self):
          self.build_system.cxxflags = ['-std=c++11', '-Wall']
          environ = self.current_environ.name
          if environ in {'clang', 'gnu'}:
              self.build_system.cxxflags += ['-pthread']
  
      @sanity_function
      def assert_hello(self):
          return sn.assert_found(r'Hello, World\!', self.stdout)
  # rfmdocend: hellothreaded
  