diff --git a/Common/include/Luau/ExperimentalFlags.h b/Common/include/Luau/ExperimentalFlags.h index 94d13ea8..56f5632f 100644 --- a/Common/include/Luau/ExperimentalFlags.h +++ b/Common/include/Luau/ExperimentalFlags.h @@ -14,6 +14,7 @@ inline bool isFlagExperimental(const char* flag) "LuauInstantiateInSubtyping", // requires some fixes to lua-apps code "LuauTinyControlFlowAnalysis", // waiting for updates to packages depended by internal builtin plugins "LuauFixIndexerSubtypingOrdering", // requires some small fixes to lua-apps code since this fixes a false negative + "LuauUpdatedRequireByStringSemantics", // requires some small fixes to fully implement some proposed changes // makes sure we always have at least one entry nullptr, }; diff --git a/bench/bench_support.lua b/bench/bench_support.lua index 9e415fc1..da637ac9 100644 --- a/bench/bench_support.lua +++ b/bench/bench_support.lua @@ -66,7 +66,8 @@ end -- and 'false' otherwise. -- -- Example usage: --- local bench = script and require(script.Parent.bench_support) or require("bench_support") +-- local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +-- local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") -- function testFunc() -- ... -- end diff --git a/bench/gc/test_BinaryTree.lua b/bench/gc/test_BinaryTree.lua index 2a797382..36dff9de 100644 --- a/bench/gc/test_BinaryTree.lua +++ b/bench/gc/test_BinaryTree.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/gc/test_GC_Boehm_Trees.lua b/bench/gc/test_GC_Boehm_Trees.lua index 08af2742..8170103d 100644 --- a/bench/gc/test_GC_Boehm_Trees.lua +++ b/bench/gc/test_GC_Boehm_Trees.lua @@ -1,5 +1,6 @@ --!nonstrict -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") local stretchTreeDepth = 18 -- about 16Mb local longLivedTreeDepth = 16 -- about 4Mb diff --git a/bench/gc/test_GC_Tree_Pruning_Eager.lua b/bench/gc/test_GC_Tree_Pruning_Eager.lua index 2111d9ff..38aa7626 100644 --- a/bench/gc/test_GC_Tree_Pruning_Eager.lua +++ b/bench/gc/test_GC_Tree_Pruning_Eager.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() local count = 1 diff --git a/bench/gc/test_GC_Tree_Pruning_Gen.lua b/bench/gc/test_GC_Tree_Pruning_Gen.lua index f88bd7f4..85081f70 100644 --- a/bench/gc/test_GC_Tree_Pruning_Gen.lua +++ b/bench/gc/test_GC_Tree_Pruning_Gen.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() local count = 1 diff --git a/bench/gc/test_GC_Tree_Pruning_Lazy.lua b/bench/gc/test_GC_Tree_Pruning_Lazy.lua index 3ea6bbef..834ec1ab 100644 --- a/bench/gc/test_GC_Tree_Pruning_Lazy.lua +++ b/bench/gc/test_GC_Tree_Pruning_Lazy.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() local count = 1 diff --git a/bench/gc/test_GC_hashtable_Keyval.lua b/bench/gc/test_GC_hashtable_Keyval.lua index fcb24826..aa7481d3 100644 --- a/bench/gc/test_GC_hashtable_Keyval.lua +++ b/bench/gc/test_GC_hashtable_Keyval.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() local t = {} diff --git a/bench/gc/test_LB_mandel.lua b/bench/gc/test_LB_mandel.lua index fe5b4eb2..a8beb4fd 100644 --- a/bench/gc/test_LB_mandel.lua +++ b/bench/gc/test_LB_mandel.lua @@ -21,7 +21,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/gc/test_LargeTableCtor_array.lua b/bench/gc/test_LargeTableCtor_array.lua index 535877f7..016dfd2d 100644 --- a/bench/gc/test_LargeTableCtor_array.lua +++ b/bench/gc/test_LargeTableCtor_array.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/gc/test_LargeTableCtor_hash.lua b/bench/gc/test_LargeTableCtor_hash.lua index 6faf766a..c46a7ab4 100644 --- a/bench/gc/test_LargeTableCtor_hash.lua +++ b/bench/gc/test_LargeTableCtor_hash.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/gc/test_Pcall_pcall_yield.lua b/bench/gc/test_Pcall_pcall_yield.lua index ac46c79e..ae0a4b46 100644 --- a/bench/gc/test_Pcall_pcall_yield.lua +++ b/bench/gc/test_Pcall_pcall_yield.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/gc/test_SunSpider_3d-raytrace.lua b/bench/gc/test_SunSpider_3d-raytrace.lua index 60e4f61e..3c050df7 100644 --- a/bench/gc/test_SunSpider_3d-raytrace.lua +++ b/bench/gc/test_SunSpider_3d-raytrace.lua @@ -22,7 +22,8 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ]] -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/gc/test_TableCreate_nil.lua b/bench/gc/test_TableCreate_nil.lua index 1eff20e9..707a2750 100644 --- a/bench/gc/test_TableCreate_nil.lua +++ b/bench/gc/test_TableCreate_nil.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/gc/test_TableCreate_number.lua b/bench/gc/test_TableCreate_number.lua index 620b5624..3e4305bd 100644 --- a/bench/gc/test_TableCreate_number.lua +++ b/bench/gc/test_TableCreate_number.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/gc/test_TableCreate_zerofill.lua b/bench/gc/test_TableCreate_zerofill.lua index 08c6c91b..fed439b4 100644 --- a/bench/gc/test_TableCreate_zerofill.lua +++ b/bench/gc/test_TableCreate_zerofill.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/gc/test_TableMarshal_select.lua b/bench/gc/test_TableMarshal_select.lua index 110d9125..9869da60 100644 --- a/bench/gc/test_TableMarshal_select.lua +++ b/bench/gc/test_TableMarshal_select.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/gc/test_TableMarshal_table_pack.lua b/bench/gc/test_TableMarshal_table_pack.lua index 45810a3f..3da855f5 100644 --- a/bench/gc/test_TableMarshal_table_pack.lua +++ b/bench/gc/test_TableMarshal_table_pack.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/gc/test_TableMarshal_varargs.lua b/bench/gc/test_TableMarshal_varargs.lua index 19ef81fc..64b41b43 100644 --- a/bench/gc/test_TableMarshal_varargs.lua +++ b/bench/gc/test_TableMarshal_varargs.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_AbsSum_abs.lua b/bench/micro_tests/test_AbsSum_abs.lua index 33b6d7a3..7e85646e 100644 --- a/bench/micro_tests/test_AbsSum_abs.lua +++ b/bench/micro_tests/test_AbsSum_abs.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_AbsSum_and_or.lua b/bench/micro_tests/test_AbsSum_and_or.lua index a613c466..c6ef3dea 100644 --- a/bench/micro_tests/test_AbsSum_and_or.lua +++ b/bench/micro_tests/test_AbsSum_and_or.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_AbsSum_math_abs.lua b/bench/micro_tests/test_AbsSum_math_abs.lua index 2f529c6a..e95ea674 100644 --- a/bench/micro_tests/test_AbsSum_math_abs.lua +++ b/bench/micro_tests/test_AbsSum_math_abs.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_Assert.lua b/bench/micro_tests/test_Assert.lua index fcc99b49..014de8dc 100644 --- a/bench/micro_tests/test_Assert.lua +++ b/bench/micro_tests/test_Assert.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_Factorial.lua b/bench/micro_tests/test_Factorial.lua index 1742c4cf..90cff22a 100644 --- a/bench/micro_tests/test_Factorial.lua +++ b/bench/micro_tests/test_Factorial.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_Failure_pcall_a_bar.lua b/bench/micro_tests/test_Failure_pcall_a_bar.lua index 16dd1bf7..5b6108ba 100644 --- a/bench/micro_tests/test_Failure_pcall_a_bar.lua +++ b/bench/micro_tests/test_Failure_pcall_a_bar.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_Failure_pcall_game_Foo.lua b/bench/micro_tests/test_Failure_pcall_game_Foo.lua index 90fb3fc8..6bd209ae 100644 --- a/bench/micro_tests/test_Failure_pcall_game_Foo.lua +++ b/bench/micro_tests/test_Failure_pcall_game_Foo.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_Failure_xpcall_a_bar.lua b/bench/micro_tests/test_Failure_xpcall_a_bar.lua index 50bff4ba..e00a3ca6 100644 --- a/bench/micro_tests/test_Failure_xpcall_a_bar.lua +++ b/bench/micro_tests/test_Failure_xpcall_a_bar.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_Failure_xpcall_game_Foo.lua b/bench/micro_tests/test_Failure_xpcall_game_Foo.lua index 5e91e38f..86dadc90 100644 --- a/bench/micro_tests/test_Failure_xpcall_game_Foo.lua +++ b/bench/micro_tests/test_Failure_xpcall_game_Foo.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_LargeTableCtor_array.lua b/bench/micro_tests/test_LargeTableCtor_array.lua index 535877f7..016dfd2d 100644 --- a/bench/micro_tests/test_LargeTableCtor_array.lua +++ b/bench/micro_tests/test_LargeTableCtor_array.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_LargeTableCtor_hash.lua b/bench/micro_tests/test_LargeTableCtor_hash.lua index 6faf766a..c46a7ab4 100644 --- a/bench/micro_tests/test_LargeTableCtor_hash.lua +++ b/bench/micro_tests/test_LargeTableCtor_hash.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_LargeTableSum_loop_index.lua b/bench/micro_tests/test_LargeTableSum_loop_index.lua index 2b65073c..2aae109e 100644 --- a/bench/micro_tests/test_LargeTableSum_loop_index.lua +++ b/bench/micro_tests/test_LargeTableSum_loop_index.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_LargeTableSum_loop_ipairs.lua b/bench/micro_tests/test_LargeTableSum_loop_ipairs.lua index b0c1085f..29205e26 100644 --- a/bench/micro_tests/test_LargeTableSum_loop_ipairs.lua +++ b/bench/micro_tests/test_LargeTableSum_loop_ipairs.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_LargeTableSum_loop_iter.lua b/bench/micro_tests/test_LargeTableSum_loop_iter.lua index 057420f6..ea2b157c 100644 --- a/bench/micro_tests/test_LargeTableSum_loop_iter.lua +++ b/bench/micro_tests/test_LargeTableSum_loop_iter.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_LargeTableSum_loop_pairs.lua b/bench/micro_tests/test_LargeTableSum_loop_pairs.lua index 55b84867..8d789fcf 100644 --- a/bench/micro_tests/test_LargeTableSum_loop_pairs.lua +++ b/bench/micro_tests/test_LargeTableSum_loop_pairs.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_MethodCalls.lua b/bench/micro_tests/test_MethodCalls.lua index fa56005f..f8b44527 100644 --- a/bench/micro_tests/test_MethodCalls.lua +++ b/bench/micro_tests/test_MethodCalls.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_OOP_constructor.lua b/bench/micro_tests/test_OOP_constructor.lua index 6e3633ce..9fec3b67 100644 --- a/bench/micro_tests/test_OOP_constructor.lua +++ b/bench/micro_tests/test_OOP_constructor.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_OOP_method_call.lua b/bench/micro_tests/test_OOP_method_call.lua index c2c6c4ed..1e5249c5 100644 --- a/bench/micro_tests/test_OOP_method_call.lua +++ b/bench/micro_tests/test_OOP_method_call.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_OOP_virtual_constructor.lua b/bench/micro_tests/test_OOP_virtual_constructor.lua index 48b1e559..df99e13b 100644 --- a/bench/micro_tests/test_OOP_virtual_constructor.lua +++ b/bench/micro_tests/test_OOP_virtual_constructor.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_Pcall_call_return.lua b/bench/micro_tests/test_Pcall_call_return.lua index 9d07708c..2a612175 100644 --- a/bench/micro_tests/test_Pcall_call_return.lua +++ b/bench/micro_tests/test_Pcall_call_return.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_Pcall_pcall_return.lua b/bench/micro_tests/test_Pcall_pcall_return.lua index a6ff3599..16bdfdd3 100644 --- a/bench/micro_tests/test_Pcall_pcall_return.lua +++ b/bench/micro_tests/test_Pcall_pcall_return.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_Pcall_pcall_yield.lua b/bench/micro_tests/test_Pcall_pcall_yield.lua index ac46c79e..ae0a4b46 100644 --- a/bench/micro_tests/test_Pcall_pcall_yield.lua +++ b/bench/micro_tests/test_Pcall_pcall_yield.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_Pcall_xpcall_return.lua b/bench/micro_tests/test_Pcall_xpcall_return.lua index a64eddfd..8ac2f0eb 100644 --- a/bench/micro_tests/test_Pcall_xpcall_return.lua +++ b/bench/micro_tests/test_Pcall_xpcall_return.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_SqrtSum_exponent.lua b/bench/micro_tests/test_SqrtSum_exponent.lua index eaddbfdd..bfd6fd72 100644 --- a/bench/micro_tests/test_SqrtSum_exponent.lua +++ b/bench/micro_tests/test_SqrtSum_exponent.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_SqrtSum_math_sqrt.lua b/bench/micro_tests/test_SqrtSum_math_sqrt.lua index 44b61cc9..1e1f42c7 100644 --- a/bench/micro_tests/test_SqrtSum_math_sqrt.lua +++ b/bench/micro_tests/test_SqrtSum_math_sqrt.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_SqrtSum_sqrt.lua b/bench/micro_tests/test_SqrtSum_sqrt.lua index 34d8b385..96880e7b 100644 --- a/bench/micro_tests/test_SqrtSum_sqrt.lua +++ b/bench/micro_tests/test_SqrtSum_sqrt.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_SqrtSum_sqrt_getfenv.lua b/bench/micro_tests/test_SqrtSum_sqrt_getfenv.lua index 242edb85..55f29e2e 100644 --- a/bench/micro_tests/test_SqrtSum_sqrt_getfenv.lua +++ b/bench/micro_tests/test_SqrtSum_sqrt_getfenv.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_SqrtSum_sqrt_roundabout.lua b/bench/micro_tests/test_SqrtSum_sqrt_roundabout.lua index fa8bfd0a..bbe48a64 100644 --- a/bench/micro_tests/test_SqrtSum_sqrt_roundabout.lua +++ b/bench/micro_tests/test_SqrtSum_sqrt_roundabout.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_StringInterp.lua b/bench/micro_tests/test_StringInterp.lua index 1e7ccbc7..55430519 100644 --- a/bench/micro_tests/test_StringInterp.lua +++ b/bench/micro_tests/test_StringInterp.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") bench.runCode(function() for j=1,1e6 do diff --git a/bench/micro_tests/test_TableCreate_nil.lua b/bench/micro_tests/test_TableCreate_nil.lua index 1eff20e9..707a2750 100644 --- a/bench/micro_tests/test_TableCreate_nil.lua +++ b/bench/micro_tests/test_TableCreate_nil.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableCreate_number.lua b/bench/micro_tests/test_TableCreate_number.lua index 620b5624..3e4305bd 100644 --- a/bench/micro_tests/test_TableCreate_number.lua +++ b/bench/micro_tests/test_TableCreate_number.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableCreate_zerofill.lua b/bench/micro_tests/test_TableCreate_zerofill.lua index 08c6c91b..fed439b4 100644 --- a/bench/micro_tests/test_TableCreate_zerofill.lua +++ b/bench/micro_tests/test_TableCreate_zerofill.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableFind_loop_ipairs.lua b/bench/micro_tests/test_TableFind_loop_ipairs.lua index f363013d..46560274 100644 --- a/bench/micro_tests/test_TableFind_loop_ipairs.lua +++ b/bench/micro_tests/test_TableFind_loop_ipairs.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableFind_table_find.lua b/bench/micro_tests/test_TableFind_table_find.lua index a7619fce..3f22122f 100644 --- a/bench/micro_tests/test_TableFind_table_find.lua +++ b/bench/micro_tests/test_TableFind_table_find.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableInsertion_index_cached.lua b/bench/micro_tests/test_TableInsertion_index_cached.lua index 7f75b022..0c34818f 100644 --- a/bench/micro_tests/test_TableInsertion_index_cached.lua +++ b/bench/micro_tests/test_TableInsertion_index_cached.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableInsertion_index_len.lua b/bench/micro_tests/test_TableInsertion_index_len.lua index b9f71e0e..120a5e28 100644 --- a/bench/micro_tests/test_TableInsertion_index_len.lua +++ b/bench/micro_tests/test_TableInsertion_index_len.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableInsertion_table_insert.lua b/bench/micro_tests/test_TableInsertion_table_insert.lua index 9efccd4d..1ad3fe22 100644 --- a/bench/micro_tests/test_TableInsertion_table_insert.lua +++ b/bench/micro_tests/test_TableInsertion_table_insert.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableInsertion_table_insert_index.lua b/bench/micro_tests/test_TableInsertion_table_insert_index.lua index af2292ba..41747139 100644 --- a/bench/micro_tests/test_TableInsertion_table_insert_index.lua +++ b/bench/micro_tests/test_TableInsertion_table_insert_index.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableIteration.lua b/bench/micro_tests/test_TableIteration.lua index 47a94a3b..5f78a48b 100644 --- a/bench/micro_tests/test_TableIteration.lua +++ b/bench/micro_tests/test_TableIteration.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableMarshal_select.lua b/bench/micro_tests/test_TableMarshal_select.lua index 110d9125..9869da60 100644 --- a/bench/micro_tests/test_TableMarshal_select.lua +++ b/bench/micro_tests/test_TableMarshal_select.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableMarshal_table_pack.lua b/bench/micro_tests/test_TableMarshal_table_pack.lua index 45810a3f..3da855f5 100644 --- a/bench/micro_tests/test_TableMarshal_table_pack.lua +++ b/bench/micro_tests/test_TableMarshal_table_pack.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableMarshal_table_unpack_array.lua b/bench/micro_tests/test_TableMarshal_table_unpack_array.lua index 67bc1efa..13d1d1c3 100644 --- a/bench/micro_tests/test_TableMarshal_table_unpack_array.lua +++ b/bench/micro_tests/test_TableMarshal_table_unpack_array.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableMarshal_table_unpack_range.lua b/bench/micro_tests/test_TableMarshal_table_unpack_range.lua index a678d8bf..e3aa68be 100644 --- a/bench/micro_tests/test_TableMarshal_table_unpack_range.lua +++ b/bench/micro_tests/test_TableMarshal_table_unpack_range.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableMarshal_varargs.lua b/bench/micro_tests/test_TableMarshal_varargs.lua index 19ef81fc..64b41b43 100644 --- a/bench/micro_tests/test_TableMarshal_varargs.lua +++ b/bench/micro_tests/test_TableMarshal_varargs.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableMove_empty_table.lua b/bench/micro_tests/test_TableMove_empty_table.lua index 75ce2729..39335564 100644 --- a/bench/micro_tests/test_TableMove_empty_table.lua +++ b/bench/micro_tests/test_TableMove_empty_table.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() local t = table.create(250001, 0) diff --git a/bench/micro_tests/test_TableMove_same_table.lua b/bench/micro_tests/test_TableMove_same_table.lua index 81576573..f62022b1 100644 --- a/bench/micro_tests/test_TableMove_same_table.lua +++ b/bench/micro_tests/test_TableMove_same_table.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() local t = table.create(5000001, 0) diff --git a/bench/micro_tests/test_TableMove_table_create.lua b/bench/micro_tests/test_TableMove_table_create.lua index 19dfd186..f03c4de7 100644 --- a/bench/micro_tests/test_TableMove_table_create.lua +++ b/bench/micro_tests/test_TableMove_table_create.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() local t = table.create(250001, 0) diff --git a/bench/micro_tests/test_TableRemoval_table_remove.lua b/bench/micro_tests/test_TableRemoval_table_remove.lua index 25acd541..13410116 100644 --- a/bench/micro_tests/test_TableRemoval_table_remove.lua +++ b/bench/micro_tests/test_TableRemoval_table_remove.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_TableSort.lua b/bench/micro_tests/test_TableSort.lua index 80031d1c..502cb2a5 100644 --- a/bench/micro_tests/test_TableSort.lua +++ b/bench/micro_tests/test_TableSort.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") local arr_months = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"} diff --git a/bench/micro_tests/test_ToNumberString.lua b/bench/micro_tests/test_ToNumberString.lua index 61104783..842b7c22 100644 --- a/bench/micro_tests/test_ToNumberString.lua +++ b/bench/micro_tests/test_ToNumberString.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") bench.runCode(function() for j=1,1e6 do diff --git a/bench/micro_tests/test_UpvalueCapture.lua b/bench/micro_tests/test_UpvalueCapture.lua index 96e8f576..4a2608c4 100644 --- a/bench/micro_tests/test_UpvalueCapture.lua +++ b/bench/micro_tests/test_UpvalueCapture.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_VariadicSelect.lua b/bench/micro_tests/test_VariadicSelect.lua index 668956f4..5a62f2d8 100644 --- a/bench/micro_tests/test_VariadicSelect.lua +++ b/bench/micro_tests/test_VariadicSelect.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/micro_tests/test_string_lib.lua b/bench/micro_tests/test_string_lib.lua index 3994c778..041f5b15 100644 --- a/bench/micro_tests/test_string_lib.lua +++ b/bench/micro_tests/test_string_lib.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") bench.runCode(function() local src = string.rep("abcdefghijklmnopqrstuvwxyz", 100) diff --git a/bench/micro_tests/test_table_concat.lua b/bench/micro_tests/test_table_concat.lua index 430ad0ab..590b7d4a 100644 --- a/bench/micro_tests/test_table_concat.lua +++ b/bench/micro_tests/test_table_concat.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") bench.runCode(function() for outer=1,28,3 do diff --git a/bench/tests/base64.lua b/bench/tests/base64.lua index 3755c54f..e580c595 100644 --- a/bench/tests/base64.lua +++ b/bench/tests/base64.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/tests/chess.lua b/bench/tests/chess.lua index f6ae2cc6..f551139e 100644 --- a/bench/tests/chess.lua +++ b/bench/tests/chess.lua @@ -1,5 +1,6 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") local RANKS = "12345678" local FILES = "abcdefgh" diff --git a/bench/tests/life.lua b/bench/tests/life.lua index 51586ad7..d050b013 100644 --- a/bench/tests/life.lua +++ b/bench/tests/life.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/tests/matrixmult.lua b/bench/tests/matrixmult.lua index d8dd4cc3..af38cb64 100644 --- a/bench/tests/matrixmult.lua +++ b/bench/tests/matrixmult.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") local function mmul(matrix1, matrix2) local shapeRows = #matrix1 diff --git a/bench/tests/mesh-normal-scalar.lua b/bench/tests/mesh-normal-scalar.lua index 368fa2fd..05bef373 100644 --- a/bench/tests/mesh-normal-scalar.lua +++ b/bench/tests/mesh-normal-scalar.lua @@ -1,5 +1,6 @@ --!strict -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/tests/pcmmix.lua b/bench/tests/pcmmix.lua index a1760f67..c98cee2c 100644 --- a/bench/tests/pcmmix.lua +++ b/bench/tests/pcmmix.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") local samples = 100_000 diff --git a/bench/tests/qsort.lua b/bench/tests/qsort.lua index 99037176..566c1b98 100644 --- a/bench/tests/qsort.lua +++ b/bench/tests/qsort.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/tests/sha256.lua b/bench/tests/sha256.lua index a01e801e..2ac0ab33 100644 --- a/bench/tests/sha256.lua +++ b/bench/tests/sha256.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/tests/shootout/ack.lua b/bench/tests/shootout/ack.lua index 540e8594..f7fd43a8 100644 --- a/bench/tests/shootout/ack.lua +++ b/bench/tests/shootout/ack.lua @@ -23,7 +23,8 @@ SOFTWARE. ]] -- http://www.bagley.org/~doug/shootout/ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/shootout/binary-trees.lua b/bench/tests/shootout/binary-trees.lua index a3c5ae64..89c5933c 100644 --- a/bench/tests/shootout/binary-trees.lua +++ b/bench/tests/shootout/binary-trees.lua @@ -25,7 +25,8 @@ SOFTWARE. -- http://benchmarksgame.alioth.debian.org/ -- contributed by Mike Pall -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/shootout/fannkuch-redux.lua b/bench/tests/shootout/fannkuch-redux.lua index e23f3a26..43bc9e41 100644 --- a/bench/tests/shootout/fannkuch-redux.lua +++ b/bench/tests/shootout/fannkuch-redux.lua @@ -25,7 +25,8 @@ SOFTWARE. -- http://benchmarksgame.alioth.debian.org/ -- contributed by Mike Pall -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/shootout/fixpoint-fact.lua b/bench/tests/shootout/fixpoint-fact.lua index 8e60e920..112acb4a 100644 --- a/bench/tests/shootout/fixpoint-fact.lua +++ b/bench/tests/shootout/fixpoint-fact.lua @@ -21,7 +21,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/shootout/heapsort.lua b/bench/tests/shootout/heapsort.lua index fe85859b..0daf97ab 100644 --- a/bench/tests/shootout/heapsort.lua +++ b/bench/tests/shootout/heapsort.lua @@ -21,7 +21,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/shootout/mandel.lua b/bench/tests/shootout/mandel.lua index fe5b4eb2..a3bbb7e5 100644 --- a/bench/tests/shootout/mandel.lua +++ b/bench/tests/shootout/mandel.lua @@ -21,7 +21,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/shootout/n-body.lua b/bench/tests/shootout/n-body.lua index 40341587..e0f9c63c 100644 --- a/bench/tests/shootout/n-body.lua +++ b/bench/tests/shootout/n-body.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/shootout/qt.lua b/bench/tests/shootout/qt.lua index 79cbe38b..d9b4a517 100644 --- a/bench/tests/shootout/qt.lua +++ b/bench/tests/shootout/qt.lua @@ -23,7 +23,8 @@ SOFTWARE. ]] -- Julia sets via interval cell-mapping (quadtree version) -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/shootout/queen.lua b/bench/tests/shootout/queen.lua index 185dabd8..c3508d60 100644 --- a/bench/tests/shootout/queen.lua +++ b/bench/tests/shootout/queen.lua @@ -21,7 +21,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/shootout/scimark.lua b/bench/tests/shootout/scimark.lua index ad0557b1..1b66df53 100644 --- a/bench/tests/shootout/scimark.lua +++ b/bench/tests/shootout/scimark.lua @@ -33,7 +33,8 @@ -- Modification to be compatible with Lua 5.3 ------------------------------------------------------------------------------ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/shootout/spectral-norm.lua b/bench/tests/shootout/spectral-norm.lua index 6d217aa6..b5116612 100644 --- a/bench/tests/shootout/spectral-norm.lua +++ b/bench/tests/shootout/spectral-norm.lua @@ -25,7 +25,8 @@ SOFTWARE. -- http://benchmarksgame.alioth.debian.org/ -- contributed by Mike Pall -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/sieve.lua b/bench/tests/sieve.lua index 718ec488..1bb45d99 100644 --- a/bench/tests/sieve.lua +++ b/bench/tests/sieve.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/tests/sunspider/3d-cube.lua b/bench/tests/sunspider/3d-cube.lua index 77fa0854..aac7a156 100644 --- a/bench/tests/sunspider/3d-cube.lua +++ b/bench/tests/sunspider/3d-cube.lua @@ -2,7 +2,8 @@ -- http://www.speich.net/computer/moztesting/3d.htm -- Created by Simon Speich -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/sunspider/3d-morph.lua b/bench/tests/sunspider/3d-morph.lua index 79e91419..8263f015 100644 --- a/bench/tests/sunspider/3d-morph.lua +++ b/bench/tests/sunspider/3d-morph.lua @@ -23,7 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ]] -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/sunspider/3d-raytrace.lua b/bench/tests/sunspider/3d-raytrace.lua index 3d5276c7..33d464b8 100644 --- a/bench/tests/sunspider/3d-raytrace.lua +++ b/bench/tests/sunspider/3d-raytrace.lua @@ -22,7 +22,8 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ]] -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/sunspider/controlflow-recursive.lua b/bench/tests/sunspider/controlflow-recursive.lua index a2591b2f..1c78a3c2 100644 --- a/bench/tests/sunspider/controlflow-recursive.lua +++ b/bench/tests/sunspider/controlflow-recursive.lua @@ -3,7 +3,8 @@ http://shootout.alioth.debian.org/ contributed by Isaac Gouy ]] -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/sunspider/crypto-aes.lua b/bench/tests/sunspider/crypto-aes.lua index e3f54087..9692cf52 100644 --- a/bench/tests/sunspider/crypto-aes.lua +++ b/bench/tests/sunspider/crypto-aes.lua @@ -9,7 +9,8 @@ * returns byte-array encrypted value (16 bytes) */]] -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") -- Sbox is pre-computed multiplicative inverse in GF(2^8) used in SubBytes and KeyExpansion [ยง5.1.1] local Sbox = { 0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76, diff --git a/bench/tests/sunspider/fannkuch.lua b/bench/tests/sunspider/fannkuch.lua index ad77e83b..08cdcc24 100644 --- a/bench/tests/sunspider/fannkuch.lua +++ b/bench/tests/sunspider/fannkuch.lua @@ -3,7 +3,8 @@ http://shootout.alioth.debian.org/ contributed by Isaac Gouy ]] -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/sunspider/math-cordic.lua b/bench/tests/sunspider/math-cordic.lua index cdb10fa2..2b622377 100644 --- a/bench/tests/sunspider/math-cordic.lua +++ b/bench/tests/sunspider/math-cordic.lua @@ -23,7 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ]] - local bench = script and require(script.Parent.bench_support) or require("bench_support") + local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/sunspider/math-partial-sums.lua b/bench/tests/sunspider/math-partial-sums.lua index 9977ceff..f0b4b0b7 100644 --- a/bench/tests/sunspider/math-partial-sums.lua +++ b/bench/tests/sunspider/math-partial-sums.lua @@ -3,7 +3,8 @@ http://shootout.alioth.debian.org/ contributed by Isaac Gouy ]] -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() diff --git a/bench/tests/sunspider/n-body-oop.lua b/bench/tests/sunspider/n-body-oop.lua index adcc15a7..e04286c8 100644 --- a/bench/tests/sunspider/n-body-oop.lua +++ b/bench/tests/sunspider/n-body-oop.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") local PI = 3.141592653589793 local SOLAR_MASS = 4 * PI * PI diff --git a/bench/tests/tictactoe.lua b/bench/tests/tictactoe.lua index 91d38f95..673dcd48 100644 --- a/bench/tests/tictactoe.lua +++ b/bench/tests/tictactoe.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/tests/trig.lua b/bench/tests/trig.lua index 702e699e..64bf611c 100644 --- a/bench/tests/trig.lua +++ b/bench/tests/trig.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") function test() diff --git a/bench/tests/voxelgen.lua b/bench/tests/voxelgen.lua index ae2cd861..b50a4592 100644 --- a/bench/tests/voxelgen.lua +++ b/bench/tests/voxelgen.lua @@ -1,4 +1,5 @@ -local bench = script and require(script.Parent.bench_support) or require("bench_support") +local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end +local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../bench_support") -- Based on voxel terrain generator by Stickmasterluke diff --git a/fuzz/CMakeLists.txt b/fuzz/CMakeLists.txt index 13d1a2a4..c18fbba5 100644 --- a/fuzz/CMakeLists.txt +++ b/fuzz/CMakeLists.txt @@ -1,5 +1,8 @@ # This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details -cmake_minimum_required(VERSION 3.26) +if(${CMAKE_VERSION} VERSION_LESS "3.26") + message(WARNING "Building the Luau fuzzer requires Clang version 3.26 of higher.") + return() +endif() include(FetchContent) diff --git a/tests/RequireByString.test.cpp b/tests/RequireByString.test.cpp index ad35b491..0e5ad4ff 100644 --- a/tests/RequireByString.test.cpp +++ b/tests/RequireByString.test.cpp @@ -56,15 +56,20 @@ public: for (int i = 0; i < 20; ++i) { - if (isDirectory(luauDirAbs + "/Luau/tests") || isDirectory(luauDirAbs + "/Client/Luau/tests")) + bool engineTestDir = isDirectory(luauDirAbs + "/Client/Luau/tests"); + bool luauTestDir = isDirectory(luauDirAbs + "/luau/tests"); + if (engineTestDir || luauTestDir) { - if (isDirectory(luauDirAbs + "/Client/Luau/tests")) + if (engineTestDir) { - luauDirRel += "/Client"; - luauDirAbs += "/Client"; + luauDirRel += "/Client/Luau"; + luauDirAbs += "/Client/Luau"; + } + else + { + luauDirRel += "/luau"; + luauDirAbs += "/luau"; } - luauDirRel += "/Luau"; - luauDirAbs += "/Luau"; if (type == PathType::Relative) return luauDirRel; @@ -209,7 +214,6 @@ TEST_CASE("PathNormalization") } } -#if 0 TEST_CASE_FIXTURE(ReplWithPathFixture, "RequireSimpleRelativePath") { @@ -390,6 +394,4 @@ TEST_CASE_FIXTURE(ReplWithPathFixture, "RequirePathWithParentAlias") assertOutputContainsAll({"true", "result from other_dependency"}); } -#endif - TEST_SUITE_END();