diff --git a/main.fmf b/main.fmf index 54b0796..c4b253c 100644 --- a/main.fmf +++ b/main.fmf @@ -1,3 +1,3 @@ contact: Vít Ondruch -test: runtest.sh +test: ./runtest.sh category: integration diff --git a/run-basic-rails-application/main.fmf b/run-basic-rails-application/main.fmf index 2dea690..d2f7c55 100644 --- a/run-basic-rails-application/main.fmf +++ b/run-basic-rails-application/main.fmf @@ -7,6 +7,13 @@ component: recommend: - rubygems - rubygem-rails +- rubygem-nokogiri +- rubygem-sqlite3 +- rubygem-sass-rails +- rubygem-puma +- rubygem-jbuilder +- rubygem-byebug +- rubygem-web-console - ruby-devel - sqlite-devel - libxml2-devel @@ -15,5 +22,6 @@ recommend: - net-tools - procps-ng - psmisc +- wget duration: 60m extra-task: /CoreOS/rubygem-rails/run-basic-rails-application diff --git a/run-basic-rails-application/runtest.sh b/run-basic-rails-application/runtest.sh index 6774bed..686c059 100755 --- a/run-basic-rails-application/runtest.sh +++ b/run-basic-rails-application/runtest.sh @@ -65,24 +65,21 @@ rlJournalStart rlPhaseEnd rlPhaseStartTest - rlRun "rails new app | tee bundle.log" 0 "Creating new rails application" + rlRun "rails new app --skip-bundle --skip-spring --skip-test --skip-bootsnap --skip-webpacker --skip-javascript -f | tee bundle.log" 0 "Creating new rails application" [ ! -z "$COLLECTIONS" ] && rlAssertGrep "bundle install --local" bundle.log || rlAssertNotGrep "bundle install --local" bundle.log rlRun "pushd app/" rlAssertExists "app" - if [[ ! "$COLLECTIONS" =~ "rh-ror50" ]] - then - rlRun "echo \"gem 'therubyracer'\" >> Gemfile" 0 "Adding therubyracer gem into Gemfile" - rlRun "bundle install" - fi - if [ -z "$COLLECTIONS" ] && rlIsRHEL '<=7' then - rlRun "echo \"gem 'nokogiri', '1.6.8'\" >> Gemfile" 0 "Adding nokogiri gem into Gemfile" - sed -i "s/gem 'spring'/#gem 'spring'/" Gemfile - rlRun "gem pristine nokogiri" 0 "Restore installed nokogiri to pristine condition" - rlRun "bundle config build.nokogiri --use-system-libraries" 0 "Build nokogiri with system libraries" - rlRun "bundle install" + rlRun "bundle install --local" + fi + + if rlIsFedora + then + rlRun "sed -i \"s/\(gem..puma.\).*/\1/\" Gemfile" 0 'Relaxing puma dependency' + rlRun "sed -i \"s/\(gem..listen.\).*/\1/\" Gemfile" 0 'Relaxing listen dependency' + rlRun "bundle install --local --without development test" fi rlRun "netstat -tulpn | grep 3000" 1 "Check if port 3000 isn't engaged" rlRun "rails server &" 0 "Running rails server" diff --git a/systemtap-static-probes-in-ruby/runtest.sh b/systemtap-static-probes-in-ruby/runtest.sh index 2eee65d..9f3ba59 100755 --- a/systemtap-static-probes-in-ruby/runtest.sh +++ b/systemtap-static-probes-in-ruby/runtest.sh @@ -41,10 +41,25 @@ RUBY=${RUBY:-ruby} _STAP_FILE="`rpm -ql $PACKAGES | grep 'ruby-exercise.stp' 2>/dev/null`" _LOG_FILE="ruby.log" _STAP_OUT="stap-out.log" +_KERNEL_DEVEL="kernel-devel-`uname -r`" # for ruby on RHEL7 and in collections PRINT="Kernel::printf" +_run_stap () { + local t="${1:-2}" + rlRun "( timeout $t stap -v ${_STAP_FILE} -o ${_LOG_FILE} 1>&2 2>${_STAP_OUT} & )" 0 "Running systemtap in background" + sleep 1 + # wait for systemtap to start + rlWaitForCmd "grep 'starting run' ${_STAP_OUT}" +} + +_log_file () { + sleep 1 + echo -e "---${_LOG_FILE}--" + grep ' -e:1$' ${_LOG_FILE} +} + rlJournalStart rlPhaseStartSetup rlAssertRpm --all @@ -54,6 +69,9 @@ rlJournalStart rlRun "pushd ${TmpDir}" _LOG_FILE="${TmpDir}/${_LOG_FILE}" touch ${_LOG_FILE} + if rlIsRHEL '>=8' || rlIsFedora; then + rlRun "rpm -q '$_KERNEL_DEVEL' || dnf install -y '$_KERNEL_DEVEL'" 0 'Installing corresponding kernel-devel: $_KERNEL_DEVEL' + fi rlPhaseEnd rlPhaseStartTest @@ -61,45 +79,50 @@ rlJournalStart rlRun "rpm -ql $PACKAGES | grep 'stp' | grep 'tapset'" 0 "Checking tapset file" rlRun "rpm -ql $PACKAGES | grep 'stp' | grep 'doc'" 0 "Checking doc file" - rlRun "{ stap -v ${_STAP_FILE} -o ${_LOG_FILE} |& tee ${_STAP_OUT}; } &" 0 "Running systemtap in background" - _STAP_PID=$! - echo -e "--_STAP_PID--\n${_STAP_PID}" # info + # stap takes long time to start for the first time + _run_stap 60 + rlRun "grep -q 'starting run' ${_STAP_OUT}" 0 "Checking stap output." + _log_file - # wait for systemtap to start - rlWaitForCmd "grep 'starting run' ${_STAP_OUT}" - - rlRun "$RUBY -e '1.0 + 9.0'" 0 "Running ruby interpreter: Float test" - rlRun "$RUBY -e '[1, 2, 3].push(4)'" 0 "Running ruby interpreter: Array test" - rlRun "$RUBY -e '(1..10).step(1)'" 0 "Running ruby interpreter: Range test" - rlRun "$RUBY -e 'Hash.new()'" 0 "Running ruby interpreter: Hash test" - rlRun "$RUBY -e '\"abc\".slice!(\"c\")'" 0 "Running ruby interpreter: String test" - rlRun "$RUBY -e '5.times { printf \"Ruby!\n\" }'" 0 "Running ruby interpreter: Cycle and print test" - - # wait for all output - rlRun "sleep 10" 0 "Waiting \"10\" seconds" - - rlRun "kill ${_STAP_PID}" 0 "Terminating stap" - sleep 1 # No Operation - - echo -e "---ps-out--" && ps -e | grep stap # info - rlRun "kill -s SIGKILL ${_STAP_PID}" 0,1 "Attempt killing stap" - rlRun "pkill stapio" 0,1 "Attempt killing all leftover stapios" - echo -e "---ps-out--" && ps -e | grep stap # info - - echo -e "---${_LOG_FILE}--" && cat ${_LOG_FILE} # info if rlIsRHEL '<7' && [ -z "$COLLECTIONS" ] then + _run_stap + rlRun "$RUBY -e '1.0 + 9.0'" 0 "Running ruby interpreter: Float test" + _log_file rlRun "grep -q 'Float::+' ${_LOG_FILE}" 0 "Checking systemtap log: Float test" # for ruby on RHEL6 PRINT="Object::printf" fi - rlRun "grep -q 'Array::push' ${_LOG_FILE}" 0 "Checking systemtap log: Array test" - rlRun "grep -q 'Range::step' ${_LOG_FILE}" 0 "Checking systemtap log: Range test" - rlRun "grep -q 'Hash::initialize' ${_LOG_FILE}" 0 "Checking systemtap log: Hash test" - rlRun "grep -q 'String::slice!' ${_LOG_FILE}" 0 "Checking systemtap log: String test" - rlRun "grep -q 'Integer::times' ${_LOG_FILE}" 0 "Checking systemtap log: Cycle and print test - iteration number" - rlRun "grep -q '$PRINT' ${_LOG_FILE}" 0 "Checking systemtap log: Cycle and print test - printf function" - rlRun "grep -q 'IO::write' ${_LOG_FILE}" 0 "Checking systemtap log: Cycle and print test - IO write" + + _run_stap + rlRun "$RUBY -e '[1, 2, 3].push(4)'" 0 "Running ruby interpreter: Array test" + _log_file + rlRun "grep -q 'Array::push -e:1$' ${_LOG_FILE}" 0 "Checking systemtap log: Array test" + + _run_stap + rlRun "$RUBY -e '(1..10).step(1)'" 0 "Running ruby interpreter: Range test" + _log_file + rlRun "grep -q 'Range::step -e:1$' ${_LOG_FILE}" 0 "Checking systemtap log: Range test" + + _run_stap + rlRun "$RUBY -e 'Hash.new()'" 0 "Running ruby interpreter: Hash test" + _log_file + rlRun "grep -q 'Hash::initialize -e:1$' ${_LOG_FILE}" 0 "Checking systemtap log: Hash test" + + _run_stap + rlRun "$RUBY -e '\"abc\".slice!(\"c\")'" 0 "Running ruby interpreter: String test" + _log_file + rlRun "grep -q 'String::slice! -e:1$' ${_LOG_FILE}" 0 "Checking systemtap log: String test" + + _run_stap + rlRun "$RUBY -e '5.times { printf \"Ruby!\n\" }'" 0 "Running ruby interpreter: Cycle and print test" + _log_file + rlRun "grep -q 'Integer::times -e:1$' ${_LOG_FILE}" 0 "Checking systemtap log: Cycle and print test - iteration number" + rlRun "grep -q '$PRINT -e:1$' ${_LOG_FILE}" 0 "Checking systemtap log: Cycle and print test - printf function" + rlRun "grep -q 'IO::write -e:1$' ${_LOG_FILE}" 0 "Checking systemtap log: Cycle and print test - IO write" + + rlRun "pkill stapio" 0,1 "Attempt killing all leftover stapios" + echo -e "---ps-out--" && ps -e | grep stap # info rlPhaseEnd rlPhaseStartCleanup