]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
1 | # Licensed to the Apache Software Foundation (ASF) under one |
2 | # or more contributor license agreements. See the NOTICE file | |
3 | # distributed with this work for additional information | |
4 | # regarding copyright ownership. The ASF licenses this file | |
5 | # to you under the Apache License, Version 2.0 (the | |
6 | # "License"); you may not use this file except in compliance | |
7 | # with the License. You may obtain a copy of the License at | |
8 | # | |
9 | # http://www.apache.org/licenses/LICENSE-2.0 | |
10 | # | |
11 | # Unless required by applicable law or agreed to in writing, | |
12 | # software distributed under the License is distributed on an | |
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
14 | # KIND, either express or implied. See the License for the | |
15 | # specific language governing permissions and limitations | |
16 | # under the License. | |
17 | ||
18 | build_features <- c( | |
19 | arrow_info()$capabilities, | |
20 | # Special handling for "uncompressed", for tests that iterate over compressions | |
21 | uncompressed = TRUE | |
22 | ) | |
23 | ||
24 | skip_if_not_available <- function(feature) { | |
25 | if (feature == "re2") { | |
26 | # RE2 does not support valgrind (on purpose): https://github.com/google/re2/issues/177 | |
27 | skip_on_valgrind() | |
28 | } | |
29 | ||
30 | yes <- feature %in% names(build_features) && build_features[feature] | |
31 | if (!yes) { | |
32 | skip(paste("Arrow C++ not built with", feature)) | |
33 | } | |
34 | } | |
35 | ||
36 | skip_if_no_pyarrow <- function() { | |
37 | skip_on_valgrind() | |
38 | skip_on_os("windows") | |
39 | ||
40 | skip_if_not_installed("reticulate") | |
41 | if (!reticulate::py_module_available("pyarrow")) { | |
42 | skip("pyarrow not available for testing") | |
43 | } | |
44 | } | |
45 | ||
46 | skip_if_not_dev_mode <- function() { | |
47 | skip_if_not( | |
48 | identical(tolower(Sys.getenv("ARROW_R_DEV")), "true"), | |
49 | "environment variable ARROW_R_DEV" | |
50 | ) | |
51 | } | |
52 | ||
53 | skip_if_not_running_large_memory_tests <- function() { | |
54 | skip_if_not( | |
55 | identical(tolower(Sys.getenv("ARROW_LARGE_MEMORY_TESTS")), "true"), | |
56 | "environment variable ARROW_LARGE_MEMORY_TESTS" | |
57 | ) | |
58 | } | |
59 | ||
60 | skip_on_valgrind <- function() { | |
61 | # This does not actually skip on valgrind because we can't exactly detect it. | |
62 | # Instead, it skips on CRAN when the OS is linux + and the R version is development | |
63 | # (which is where valgrind is run as of this code) | |
64 | linux_dev <- identical(tolower(Sys.info()[["sysname"]]), "linux") && | |
65 | grepl("devel", R.version.string) | |
66 | ||
67 | if (linux_dev) { | |
68 | skip_on_cran() | |
69 | } | |
70 | } | |
71 | ||
72 | skip_if_r_version <- function(r_version) { | |
73 | if (getRversion() <= r_version) { | |
74 | skip(paste("R version:", getRversion())) | |
75 | } | |
76 | } | |
77 | ||
78 | process_is_running <- function(x) { | |
79 | cmd <- sprintf("ps aux | grep '%s' | grep -v grep", x) | |
80 | tryCatch(system(cmd, ignore.stdout = TRUE) == 0, error = function(e) FALSE) | |
81 | } |