Comments (4)
I don't think that a flag is required. The script runs xrandr
from $PATH
, so
#!/bin/sh
#
TEST_DIRECTORY=`mktemp -d`
[ -n "${TEST_DIRECTORY}" -a -d "${TEST_DIRECTORY}" ] || exit 1
cat > "${TEST_DIRECTORY}/xrandr" <<EOF
#!/bin/sh
echo "Test script, could output a fixture instead of calling '\$*'" >&2
exec /usr/bin/xrandr \$@
EOF
chmod a+x "${TEST_DIRECTORY}/xrandr"
export PATH="${TEST_DIRECTORY}:${PATH}"
./autorandr.py
rm -rf "${TEST_DIRECTORY}"
should work fine.
Automated testing certainly is nice-to-have , but frankly I don't find that we'd benefit much from it here. autorandr doesn't have overly complex logic, xrandr
output has been stable for at least some years, and other than that, there's mostly syntax errors to test for. That being said, if you're willing to write some useful (separate!) tests and a script that runs through them, we can of course setup a CI service (I think I'd prefer Travis) to run it automatically.
from autorandr.
Here's a script that builds all versions of the xrandr frontend, should be useful for testing:
https://gist.github.com/phillipberndt/57e317f0b9619943f6d3
On my system, every version (except for 1_0_2
, but I doubt that that's still around..) works with autorandr.
from autorandr.
See
https://gist.github.com/phillipberndt/cc3e7e38d8c77b564aef
for a more complete test environment.
from autorandr.
After your latest PR, I'm starting to get your point regarding the need for more testing. My gist doesn't suffice though, since it only tests if autorandr parses the configurations correctly. We'd also need to be able to simulate changes in configurations.
So, IMO, what we need is a state-preserving test version of xrandr. Each test would consist of an initial state, an autorandr call, and a final state that is compared to the final state of the test. It must also be configurable to generate error conditions, like for example the "you cannot change more than two screens in one call" case, or "the WM crashes if all screens are disabled". What is most important is that the generation of such test needs to be to some extent automated, such that users can generate tests themselves without knowing much about the internals if something doesn't work as expected for them.
from autorandr.
Related Issues (20)
- Question: should autorandr systemd service change profile when external monitor is unplugged? HOT 2
- Use of --skip-options breaks --current HOT 1
- Parsing XRandR output failed HOT 1
- Detected Wayland session 'wayland-0'. Exiting.
- Failed to apply profile because xrandr cannot find mode
- postscript loses authentication for systemctl commands after suspending HOT 1
- Unhandled exception (local variable 'output' referenced before assignment) HOT 1
- Broken regexes due to missing `r` string literal HOT 6
- Unable to save lid state when using NVIDIA GPU (no eDP / LVDS output)
- Total system crash + soundloop could be caused by autorandr
- Total system crash + soundloop could be caused by autorandr
- No XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE events HOT 2
- Prevent profile change with screen lock HOT 1
- Additional Documentation HOT 7
- autorandr.service "Failed to load profile: 'xxx' : Profile not found" althoug profile exists HOT 1
- Failed to apply profile due to `--crtc` option HOT 3
- Incorrect profile settings HOT 1
- autorandr /usr/bin/autorandr:210: SyntaxWarning: invalid escape sequence '\s' XRANDR_OUTPUT_REGEXP = """(?x) /usr/bin/autorandr:236: SyntaxWarning: invalid escape sequence '\s' """ + XRANDR_PROPERTIES_REGEXP + """ | # Properties to include in the profile /usr/bin/autorandr:248: SyntaxWarning: invalid escape sequence '\S' XRANDR_OUTPUT_MODES_REGEXP = """(?x) /usr/bin/autorandr:592: SyntaxWarning: invalid escape sequence '\s' version = re.search("xrandr program version\s+([0-9\.]+)", version_string).group(1) /usr/bin/autorandr:888: SyntaxWarning: invalid escape sequence '\+' match = re.match("(?P<w>[0-9]+)x(?P<h>[0-9]+)(?:\+(?P<x>[0-9]+))?(?:\+(?P<y>[0-9]+))?.*", output.options["panning"]) HOT 6
- please support appimage , or binary file HOT 1
- Enabling udev rule / systemd service on a per-user basis? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autorandr.