Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import argparse
import os
import random
import re
import shlex
import shutil
import subprocess
Expand Down Expand Up @@ -236,8 +237,15 @@ def decorator(f):
def decorated(self, *args, **kwargs):
if should_skip == 'error':
raise Exception(f'This test requires a browser that supports {feature.name} but your browser {get_browser()} does not support this. Run with {skip_env_var}=1 or EMTEST_AUTOSKIP=1 to skip this test automatically.')
elif should_skip and bool(re.search(r"MIN_.*_VERSION", os.getenv('EMCC_CFLAGS', ''))):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would maybe just simplify this and skip whenever EMCC_CFLAGS is present at all in the environment at all. i.e. just be conservative in this case.

I'm honestly not sore that injecting cflags via external environment variables like this into the test suite is a good long term stratagy, so I'm hoping we can find a better way one day.

Copy link
Collaborator Author

@juj juj Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would maybe just simplify this and skip whenever EMCC_CFLAGS is present at all in the environment at all. i.e. just be conservative in this case.

Hmm, that sounds like being imprecise, rather than conservative? I wonder if there is a scenario that would help?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I was thinking more like "If the user sepecified EMCC_CFLAGS when all best are off".. it would be so easy to trivally break all kinds of tests using EMCC_CFLAGS injection. Thats why I think we should come up with a better way for you do set you min browser versions.

# should_skip=True, so we should skip running this test. However, user has specified a MIN_x_VERSION
# directive in EMCC_CFLAGS, so we cannot even try to compile this test, or otherwise emcc can
# error out on the MIN_x_VERSION being too old. So skip both compiling+running this test.
self.skipTest(message)
elif should_skip:
# Skip running this test in a browser, but do test compiling it, to get partial coverage.
self.skip_exec = message

f(self, *args, **kwargs)

return decorated
Expand Down