<commit_before>ENV['RAILS_ENV'] = 'test'

puts "Testing Rails v#{Rails.version}"

puts "\n***Travis CI VM info for debugging POSIX lock fail***\n"
begin; puts "$ sqlite3 -version\n#{`sqlite3 -version`}"; rescue; end
begin; puts "$ uname -r\n#{`uname -r`}"; rescue; end
begin; puts "$ cat /proc/version\n#{`cat /proc/version`}"; rescue; end
begin; puts "$ lsb_release -a\n#{`lsb_release -a`}"; rescue; end
begin; puts "$ cat /proc/mounts\n#{`cat /proc/mounts`}"; rescue; end
begin; puts "$ pwd\n#{`pwd`}"; rescue; end
begin; puts "$ mount\n#{`mount`}"; rescue; end
begin
  puts "testing flock..."
  system 'flock test.lock sleep 5 & sleep 1; if ! flock -n test.lock true ; then echo "flock works"; else echo "flock fails"; fi'
  # give it time to output
  sleep 8
rescue; end
begin
  puts "testing that python is available for further lock testing"
  puts "$ python -V\n#{`python -V`}"
  puts "python command test (should output that is usable): #{`python -c 'print "python is usable here"' 2>&1`}"
rescue
  puts "python not on path"
end<commit_msg>Using python fcntl test from <NAME><commit_after>ENV['RAILS_ENV'] = 'test'

puts "Testing Rails v#{Rails.version}"

puts "\n***Travis CI VM info for debugging POSIX lock fail***\n"
begin; puts "$ sqlite3 -version\n#{`sqlite3 -version`}"; rescue; end
begin; puts "$ uname -r\n#{`uname -r`}"; rescue; end
begin; puts "$ cat /proc/version\n#{`cat /proc/version`}"; rescue; end
begin; puts "$ lsb_release -a\n#{`lsb_release -a`}"; rescue; end
begin; puts "$ cat /proc/mounts\n#{`cat /proc/mounts`}"; rescue; end
begin; puts "$ pwd\n#{`pwd`}"; rescue; end
begin; puts "$ mount\n#{`mount`}"; rescue; end
begin
  puts "testing flock..."
  system 'flock test.lock sleep 5 & sleep 1; if ! flock -n test.lock true ; then echo "flock works"; else echo "flock fails"; fi'
  # give it time to output
  sleep 8
rescue; end

begin
  puts "testing that python is available for further lock testing"
  puts "$ python -V\n#{`python -V`}"
  begin
    puts "testing fcntl lock via python script provided by <NAME>."
    puts "assuming that a successful test will report something like IOError: [Errno 35] Resource temporarily unavailable"
    py_out = `python -c "import fcntl, os, time\n\nfd = open('/tmp/test.lock', 'w')\nif os.fork():\n    fcntl.lockf(fd, fcntl.LOCK_EX)\n    os.wait()\nelse:\n    time.sleep(0.1)\n    fcntl.lockf(fd, fcntl.LOCK_EX|fcntl.LOCK_NB)\n"`
    if py_out && py_out['Resource temporarily unavailable']
      puts "python test says fcntl lock works"
    else
      puts "maybe fcntl lock not working, according to python"
    end
  rescue => e
    puts "python test of fcntl failed:\n#{e.message}\n#{e.backtrace.join('\n')}"
  end
rescue
  puts "python not on path"
end
{'fraction_non_alphanumeric': 0.1596330275229358, 'fraction_numerical': 0.005871559633027523, 'mean_word_length': 3.965391621129326, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2087528', 'n_tokens_mistral': 981, 'n_tokens_neox': 986, 'n_words': 330}