Skip to content

Commit

Permalink
rename circleci_tests to ci_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mdahlhausen committed Oct 5, 2023
1 parent afd6ff7 commit c3aae3b
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ end
require 'rake/testtask'
namespace :test do
full_file_list = nil
if File.exist?('test/circleci_tests.txt')
if File.exist?('test/ci_tests.txt')
# load test files from file.
full_file_list = FileList.new(File.readlines('test/circleci_tests.txt'))
full_file_list = FileList.new(File.readlines('test/ci_tests.txt'))
# Select only .rb files that exist
full_file_list.select! { |item| item.include?('rb') && File.exist?(File.absolute_path("test/#{item.strip}")) }
full_file_list.map! { |item| File.absolute_path("test/#{item.strip}") }
File.open('test/circleci_tests.json', 'w') do |f|
File.open('test/ci_tests.json', 'w') do |f|
f.write(JSON.pretty_generate(full_file_list.to_a))
end
else
puts 'Could not find list of files to test at test/circleci_tests.txt'
puts 'Could not find list of files to test at test/ci_tests.txt'
return false
end

Expand Down
2 changes: 1 addition & 1 deletion test/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/build/
/coverage/
**/reports/
/circleci_tests.json
/ci_tests.json
File renamed without changes.
34 changes: 17 additions & 17 deletions test/helpers/ci_test_generator.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require 'fileutils'
require 'erb'
module CITestGenerator
# default loation circleci_tests.txt file when run on
@@ci_test_path = File.absolute_path(File.join(__FILE__, "..", "..", "circleci_tests.txt"))
@@local_ci_test_path = File.absolute_path(File.join(__FILE__, "..", "..", "local_circleci_tests.txt"))
# default loation ci_tests.txt file when run on
@@ci_test_path = File.absolute_path(File.join(__FILE__, "..", "..", "ci_tests.txt"))
@@local_ci_test_path = File.absolute_path(File.join(__FILE__, "..", "..", "local_ci_tests.txt"))
@@file_out_dir = File.absolute_path(File.join(__FILE__, "..", "..", "ci_test_files"))
@@doe_dir = File.absolute_path(File.join(__FILE__, "..", "..", "doe_prototype"))

Expand Down Expand Up @@ -69,18 +69,18 @@ def self.generate_necb_bldg_test_files

#:@param local_run [Boolean] set to true if the run is a local run
def self.write_file_path_to_ci_tests_txt(local_run, verbose)
circleci_tests_txt_path = @@ci_test_path # use the default location os the circleci_tests.txt
ci_tests_txt_path = @@ci_test_path # use the default location os the ci_tests.txt

# if the run is a local, make a copy of the default circleci_tests.txt, and rename it
# if the run is a local, make a copy of the default ci_tests.txt, and rename it
if local_run
FileUtils.copy(@@ci_test_path, @@local_ci_test_path)
# point circleci_tests_txt_path to the newly created copy of the circleci_tests.txt
circleci_tests_txt_path = @@local_ci_test_path
# point ci_tests_txt_path to the newly created copy of the ci_tests.txt
ci_tests_txt_path = @@local_ci_test_path
end
#puts circleci_tests_txt_path
#puts ci_tests_txt_path

# get the content of circleci_tests.txt file
files = IO.readlines(circleci_tests_txt_path)
# get the content of ci_tests.txt file
files = IO.readlines(ci_tests_txt_path)
new_file_content = files.clone

# remove lines which contains the test_necb_bldg_*.rb, or other
Expand Down Expand Up @@ -112,24 +112,24 @@ def self.write_file_path_to_ci_tests_txt(local_run, verbose)
end
}

# overwrite circleci_tests.txt without the test_necb_bldg_*.rb lines
File.open(circleci_tests_txt_path, 'w') {|f|
# overwrite ci_tests.txt without the test_necb_bldg_*.rb lines
File.open(ci_tests_txt_path, 'w') {|f|
new_file_content.each {|line|
f.puts line if verbose
}
}

# add the new nrcan files generated by this script to the circleci_tests.txt
File.open(circleci_tests_txt_path, 'a') {|f|
# add the new nrcan files generated by this script to the ci_tests.txt
File.open(ci_tests_txt_path, 'a') {|f|
files_path = File.expand_path(File.join(__FILE__, "..", "..", "ci_test_files", "test_necb_*.rb"))
puts files_path if verbose
Dir[files_path].sort.each {|path|
f.puts(path.to_s.gsub(/^.+(openstudio-standards\/test\/)/, ''))
}
}

# add the new doe files generated by this script to the circleci_tests.txt
File.open(circleci_tests_txt_path, 'a') {|f|
# add the new doe files generated by this script to the ci_tests.txt
File.open(ci_tests_txt_path, 'a') {|f|
files_path = File.expand_path(File.join(__FILE__, "..", "..", "ci_test_files", "doe_test*.rb"))
puts files_path if verbose
Dir[files_path].sort.each {|path|
Expand Down Expand Up @@ -1761,7 +1761,7 @@ def self.generate(local_run = false, verbose = true)
# generate ODE building tests
generate_doe_building_test_files(verbose)

# write the generated test files to circleci_tests.txt file,
# write the generated test files to ci_tests.txt file,
# and remove large tests that were split
write_file_path_to_ci_tests_txt(local_run, verbose)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def snek
end

class GeneratorNECBRegressionTests
# default location circleci_tests.txt file when run on
# default location ci_tests.txt file when run on

def initialize()
@file_out_dir = File.absolute_path(File.join(__dir__, "..", 'tests'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def snek
end

class GeneratorNECBRegressionTests
# default loation circleci_tests.txt file when run on
# default loation ci_tests.txt file when run on

def initialize()
@file_out_dir = File.absolute_path(File.join(__dir__,'..','tests'))
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_run_all_tests_locally.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require_relative './helpers/parallel_tests'
TestListFile = File.join(File.dirname(__FILE__), 'circleci_tests.txt')
TestListFile = File.join(File.dirname(__FILE__), 'ci_tests.txt')

class RunAllTests < Minitest::Test
def test_all()
Expand Down

0 comments on commit c3aae3b

Please sign in to comment.