Skip to content

Commit e99255b

Browse files
committed
[rust] Set DISPLAY env to :1 for Rust tests
1 parent 55475e9 commit e99255b

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

.bazelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ build --test_output=errors
8282

8383
test --test_env=CI
8484
test --test_env=DASHBOARD_URL
85-
test --test_env=DISPLAY
85+
test --test_env=DISPLAY=":1"
8686
test --test_env=FIREFOX_NIGHTLY_BINARY
8787
test --test_env=GITHUB_ACTIONS
8888
test --test_env=MOZ_HEADLESS

rust/src/ffmpeg.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use crate::config::OS::{LINUX, MACOS, WINDOWS};
18+
use crate::config::OS::{MACOS, WINDOWS};
1919
use crate::downloads::download_to_tmp_folder;
2020
use crate::files::{
2121
compose_driver_path_in_cache, create_parent_path_if_not_exists, get_filename_with_extension,
@@ -43,9 +43,8 @@ const FFMPEG_LINUX_RELEASE_URL: &str = "https://github.com/BtbN/FFmpeg-Builds/re
4343
const FFMPEG_MACOS_RELEASE_URL: &str = "https://evermeet.cx/ffmpeg/ffmpeg-{}.zip";
4444
const FFMPEG_RECORD_FRAME_RATE: &str = "30";
4545
const FFMPEG_RECORD_DESKTOP_WINDOWS_COMMAND: &str = "{} -f gdigrab -i desktop -r {} -q:v 1 -y {}";
46-
const FFMPEG_RECORD_DESKTOP_LINUX_COMMAND: &str =
47-
"{} -f x11grab -i {}+0,0 -r {} -vcodec huffyuv -y {}";
48-
const FFMPEG_RECORD_DESKTOP_MACOS_COMMAND: &str = r#"{} -f avfoundation -i "0:0" -r {} -y {}"#;
46+
const FFMPEG_RECORD_DESKTOP_LINUX_COMMAND: &str = "{} -f x11grab -i {} -r {} -vcodec huffyuv -y {}";
47+
const FFMPEG_RECORD_DESKTOP_MACOS_COMMAND: &str = r#"{} -f avfoundation -i "{}:0" -r {} -y {}"#;
4948
const FFMPEG_RECORDING_EXTENSION: &str = "avi";
5049
const FFMPEG_RECORDING_FOLDER: &str = "recordings";
5150
const FFMPEG_DEFAULT_DISPLAY: &str = ":0";
@@ -211,19 +210,19 @@ pub fn record_desktop_with_ffmpeg(
211210
"Recording desktop with {} to {}",
212211
FFMPEG_NAME, &recording_name
213212
));
214-
let command = if LINUX.is(os) {
215-
let env_display = env::var(ENV_DISPLAY).unwrap_or(FFMPEG_DEFAULT_DISPLAY.to_string());
216-
Command::new_single(format_four_args(
213+
let command = if WINDOWS.is(os) {
214+
Command::new_single(format_three_args(
217215
get_recording_command(os),
218216
&path_to_string(&ffmpeg_path),
219-
&env_display,
220217
FFMPEG_RECORD_FRAME_RATE,
221218
&recording_name,
222219
))
223220
} else {
224-
Command::new_single(format_three_args(
221+
let env_display = env::var(ENV_DISPLAY).unwrap_or(FFMPEG_DEFAULT_DISPLAY.to_string());
222+
Command::new_single(format_four_args(
225223
get_recording_command(os),
226224
&path_to_string(&ffmpeg_path),
225+
&env_display,
227226
FFMPEG_RECORD_FRAME_RATE,
228227
&recording_name,
229228
))

rust/tests/record_tests.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,4 @@ fn test_record() {
4545
}
4646
};
4747
println!("Recording test status code: {:?}", status_code);
48-
panic!("Forced error");
4948
}

0 commit comments

Comments
 (0)