Commit graph

16 commits

Author SHA1 Message Date
Dentomologist
2999cca41b UnitTests: Fix -Wrange-loop-construct warnings
Don't use reference variable bound to a temporary value
2022-06-03 22:28:17 -07:00
Pierre Bourdon
e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Dentomologist
83f912b58a UnitTests: Add setup error checking
Check return value of calls to File::CreateTempDir() from CoreTiming,
FileSystem, and MMIO test classes to verify the test user directory
exists, and fail the tests otherwise.
2021-01-22 11:49:59 -08:00
Shawn Hoffman
9d880c2db3 UnitTests: quiet warnings 2020-08-16 15:17:11 -07:00
Léo Lam
bbc8631357 IOS/FS: Fix CreateFullPath to not create directories that already exist
This fixes CreateFullPath to not create directories when it is known
that they already exist, instead of calling CreateDirectory anyway
and checking if the error is AlreadyExists. (That doesn't work
now that we have an accurate implementation of CreateDirectory
that performs permission checks before checking for existence.)

I'm not sure what I was thinking when I wrote that function.

Also adds some tests for CreateFullPath.
2020-01-30 18:07:03 +01:00
Léo Lam
031c63eb8a UnitTests/FS: Improve deletion test
* Test recursive directory deletion
* Test "in use" check for both files and directories
2020-01-25 17:54:58 +01:00
Léo Lam
af416c60b0 UnitTests/FS: Add ReadDirectory ordering test (issue 10234) 2020-01-25 17:54:58 +01:00
Léo Lam
8789a6ddb3 UnitTests/FS: Fix file rename tests
Files cannot be given a different file name, only moved across
directories.

Add a test for that behaviour and fix the existing
RenameWithExistingTargetFile test.
2020-01-25 17:54:58 +01:00
Léo Lam
d4ba0acb3a UnitTests/FS: Add path validity and splitting tests 2020-01-25 17:54:57 +01:00
Léo Lam
484cfb9328 UnitTests/FS: Add metadata tests 2020-01-25 17:53:39 +01:00
Léo Lam
6b9aef7042 FS: Add a struct for modes
As suggested here: https://dolp.in/pr7059#pullrequestreview-125401778

More descriptive than having a std::tuple of FS::Mode, and lets us
give names to known triplets of modes (like in ES). Functions that
only forward mode arguments are slightly less verbose now too.
2018-06-03 20:45:35 +02:00
Léo Lam
7feabcd096 IOS/FS: Fix rename not handling existing target correctly
The existing backend did not handle cases where the target exists
correctly.

This is a bug that has been around forever but was only recently
exposed when ES started to use our FS code.

Also adds some unit tests to make sure this won't get broken again.
2018-05-08 23:55:13 +02:00
Léo Lam
45647df349 UnitTests: Add tests for the Wii filesystem
This adds unit tests for the Wii filesystem now that the filesystem
interface is neatly separated from the IPC code.

Basic FS functionality is tested, in addition to problematic usages and
edge cases that Dolphin used to handle incorrectly (which of course
broke emulated software).

These tests should make it quite a bit harder to introduce regressions.

Issues that are covered by the tests in particular:

* Metadata: issue 10234 (though tests are commented out for now because
  Dolphin doesn't support NAND images yet so it can't track metadata);

* EOF seeks/reads: https://github.com/dolphin-emu/dolphin/pull/4942

* Read/write operations from multiple handles: see issue 2917, 5232 and
  8702 and https://github.com/dolphin-emu/dolphin/pull/2649
2018-04-15 14:29:27 +02:00
Léo Lam
60c6fbe9cc Add CommonTitles.h for common Wii title IDs 2017-06-26 15:17:55 +02:00
Léo Lam
6c3069be97 IOS/ESFormats: Use SignedBlobReader for TMDs and tickets 2017-06-14 22:45:29 +02:00
Léo Lam
47a09de019 Add unit tests for IOS/ESFormats
This adds unit tests for IOS/ESFormats, and in particular, for the
TMDReader. It is tested using invalid TMDs (to check IsValid()) and
two valid, properly signed TMDs.

Things which are now tested:

* Title type helper functions.
* TMDReader: Validity check.
* TMDReader: General information returned by the Get*() methods.
* TMDReader: Raw TMD and generated TMD view, compared against IOS.
* TMDReader: Game ID generation code (which is Dolphin specific).
* TMDReader: Content information: getting by ID/index, order, metadata.
2017-04-05 20:54:11 +02:00