70 Commits

Author SHA1 Message Date
Ahsan Fayaz
5b3b4ae638 Add "GameMode contributors" to copyright notice
Attribute the contributions made by members of the community, but avoid
unweildy and inconsistent copyright notices at the top of each file.

Existing contributor copyright notices have been left as-is.
2025-02-24 15:14:21 +00:00
Andrew Koroluk
2f69f7c023 Add suggestion message to failed CPU governernor test 2024-11-04 11:04:05 +00:00
Sam Gleske
23493e5cc3 Fix GitHub Actions Format Check
This change fixes the format check in GitHub actions ran by `clang-format`.

Dockerfile

```dockerfile
FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive

RUN set -ex; \
apt-get update; \
apt-get install -y build-essential meson appstream clang clang-format clang-tools libdbus-1-dev libinih-dev libsystemd-dev git

RUN set -ex; \
yes | adduser ci-user

USER ci-user
```

Environment setup

```bash
sudo su -g docker $USER
docker build -t ci .
```

clang-format fix

```bash
docker run -e CI=true --rm -v "$PWD:$PWD" -w "$PWD" --init ci ./scripts/format-check.sh
```
2022-02-21 09:51:59 +00:00
Kira Bruneau
126e67fb6b Run executables from PATH instead of /usr/bin
Not all distributions install non-system binaries into /usr/bin. For
example, NixOS installs packages to /nix/store using a unique hash
generated from the inputs used to build it:

/nix/store/jld7jh3ilvbg91zvn1bdyawfc55b9jk8-polkit-0.118-bin/bin/pkexec
2022-02-03 15:42:22 +00:00
qarmin
94444cb76f Check index before using 2020-05-06 11:05:02 +01:00
Alex Smith
57efe440c3 clang-format fix 2019-10-22 12:41:37 +01:00
Alex Smith
b2b09fbb83 Run "sleep 5" instead of "sh" for the gamemoderun test
Don't really want to try to run an interactive shell here.
2019-10-22 12:36:59 +01:00
Alex Smith
d25379e001 Increase a test timeout to avoid spurious failures 2019-10-22 12:31:53 +01:00
Marc Di Luzio
e537caf170 Ensure we're more specific about clang format options and include order 2019-06-01 10:57:27 +01:00
Marc Di Luzio
2e67906402 Remove unneeded includes 2019-06-01 10:57:27 +01:00
Marc Di Luzio
1b78d0dcf7 Restructure files and libraries
Rename a bunch of files to make the consistent
	Create two new subdirectories for common code, and utilities
2019-06-01 10:54:22 +01:00
Alex Smith
09e475e092 Typo fixes 2019-05-19 11:05:41 +01:00
Marc Di Luzio
0d018d91a8 Implement some error logging/checking and clean up some TODO comments 2019-05-13 19:44:22 +01:00
Marc Di Luzio
ef29b35258 Make sure we don't leave a hanging gamemode request from the child process
Otherwise other tests might have to wait for the reaper thread to clean it up
2019-05-13 19:44:22 +01:00
Marc Di Luzio
139b90e0b7 Refactor the process test function
Make it simply take a functor to the per tid get method
2019-05-13 19:44:22 +01:00
Marc Di Luzio
4091a0c532 Now that renice works - set it to a hard fail again
Also move some comments around
2019-05-13 19:44:22 +01:00
Marc Di Luzio
16c932f5d0 Adjust logs for generic process test function 2019-05-13 19:44:22 +01:00
Marc Di Luzio
3ac49385dc Add a test for renicing multithreaded processes 2019-05-13 19:44:22 +01:00
Marc Di Luzio
87cfd9c5a6 Remove error log about known issue now that it is fixed 2019-05-13 19:44:22 +01:00
Marc Di Luzio
6639b17500 Make the multithreaded ioprio tests not cause a full failure 2019-05-13 19:44:22 +01:00
Marc Di Luzio
6869470f9b Fix feature status codes - failures here should be considered a failure 2019-05-13 19:44:22 +01:00
Marc Di Luzio
934b497603 Implement multithreaded test framework (and use for ioprio)
ioprio tests will now fail due to https://github.com/FeralInteractive/gamemode/issues/140
2019-05-13 19:44:22 +01:00
Marc Di Luzio
2249a71355 Get ready for re-setting ioprio value on un-register
Implements tests for feature

	Fixes CLAMP macro
2019-05-11 12:08:29 +01:00
Marc Di Luzio
09d63ae4f5 Set up for resetting niceness value
Add tests to check this feature
	Apply config validation in config for simplicity

	Note: if anything messes with the niceness (ie. it starts non-zero, or it's not the expected value during setup, we'll bail out)
2019-05-11 12:08:29 +01:00
Christian Kellner
41b85c245d Rewrite strncpy to silence compiler warning
Instead of initializing the char array to 0 and writing N-1 bytes,
write N-1 bytes and set the last byte manually to 0. This seems
to make gcc happy.
2019-03-28 17:14:00 +01:00
Christian Kellner
d12ab6830f No old-style function definitions.
Specify void as argument type for functions that don't take args.
2019-03-28 11:40:40 +00:00
Christian Kellner
bbde1d0357 Ensure strncpy'ed strings are all null terminated
If there is no null byte among the first n bytes of the source the
resulting string will not be properly null terminated.
Ensure that all strings that are copied via strncpy are properly
terminated copy "sizeof (dest) - 1" bytes and manually terminate
the string in the cases the array was not initialized.

Example compiler warning:
  ../daemon/gamemode-tests.c: In function ‘run_cpu_governor_tests’:
  ../daemon/gamemode-tests.c:326:4: warning: ‘strncpy’ specified bound
      256 equals destination size [-Wstringop-truncation]
    strncpy(defaultgov, currentgov, CONFIG_VALUE_MAX);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-03-28 11:40:40 +00:00
Alex Smith
10a31f8dec Update copyright years to 2019 2019-03-14 16:59:30 +00:00
Marc Di Luzio
fec32ac53d Remove the nv_perf_level config option and figure it out programmatically
This also fixes the instances in testing where we don't have the nv overclock in use, but we do have the mode set

	Solves issues explaining the what the perf_level actually meant, and future proofs for any PR that wants to set individual perf levels
2019-03-10 15:19:34 +00:00
Marc Di Luzio
7fb1950357 Fix formatting 2019-03-10 10:32:08 +00:00
Marc Di Luzio
54d7d3f259 Allow nv_perl_level and nv_powermizer_mode to be set independently 2019-03-10 10:32:08 +00:00
Marc Di Luzio
834a18aab4 Implement nv_powermizer_mode option to allow setting the Nvidia powermizer mode 2019-03-10 10:32:08 +00:00
Marc Di Luzio
9ade4481c3 Change AMD overclocking to simply be setting the power_dpm_force_performance_level file for now
This covers the MVP for now, and simply allows pinning the power level to "high"

	Full overclocking set up is somewhat more complicated, and it'll be better to implement that at the same time as the same for Nvidia, where we're currently only really setting the top end power level
2019-03-10 10:32:08 +00:00
Marc Di Luzio
20efaaa33f Rename the core and mem stats to nv_ prefix
These will be NV only going forward, as AMD needs a different chunk of work
2019-03-10 10:32:08 +00:00
Marc Di Luzio
6a240d550e Extend the sleep for the child gamemode in tests 2019-03-08 12:32:08 +00:00
Marc Di Luzio
0efd65fc78 set the default gov not the desired gov in tests 2019-03-08 12:14:01 +00:00
Marc Di Luzio
c215626ccd Add "script_timeout" config value to control if a user wants to extend the script timeout before kill value 2019-03-07 17:51:57 +00:00
Marc Di Luzio
53d1700a68 Add the timout to the call signature of run_external_process 2019-03-07 17:51:57 +00:00
Marc Di Luzio
4578af47ba Combine the two run_external_process functions so they both have the same timeout protection 2019-03-07 17:51:57 +00:00
Marc Di Luzio
1665447350 Use run_external_process for the script execution
This protects the main process against script exection and allows more detailed error handling
2019-03-07 17:51:57 +00:00
Marc Di Luzio
9df1dd857c Try waiting for the reaper thread at the start of tests if needed 2019-03-07 17:51:57 +00:00
Alex Smith
3c28e84700 Merge pull request #105 from mdiluz/auto-detect-vendor
Detect the GPU vendor automatically
2019-03-04 08:43:58 +00:00
Marc Di Luzio
c1dfd8bbc4 Add gamemode error strings to printouts to help debug issues 2019-02-21 17:34:20 +00:00
Marc Di Luzio
218dc9dab8 Fix up formatting 2019-02-21 17:34:20 +00:00
Marc Di Luzio
70c317233f Wait for the child to finish up 2019-02-21 17:34:20 +00:00
Marc Di Luzio
3a624350d1 Add flavor to error log messages 2019-02-21 17:34:20 +00:00
Marc Di Luzio
baf295773b Implement supervisor tests 2019-02-21 17:34:20 +00:00
Marc Di Luzio
ebe525d04e Fix up testing now that we detect the vendor 2019-02-21 17:26:14 +00:00
Marc Di Luzio
0847d3b452 Remove the vendor config value in prep for it to be auto-detected 2019-02-21 17:26:14 +00:00
Marc Di Luzio
94b6a34f65 Add test for gamemoderun and the reaper thread
Using a simple test allows us to check both at once
2019-02-20 18:08:49 +00:00