Commit graph

10 commits

Author SHA1 Message Date
Thomas Lauf
7b4a234f03 Unify coding style
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-12-23 22:38:31 +01:00
Thomas Lauf
6d79ea4a6d Update copyright statements
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-09-18 12:33:17 +02:00
Shaun Ruffell
7a75210ce1 AtomicFile: Operate on the target of symlinks
Currently, if an AtomicFile is opened on a symlink, the AtomicFile would
end up overwriting the link. This change makes AtomicFiles operate on
the targets of the links and not the links themselves.

```
$ test/AtomicFileTest
1..22
ok 1 - AtomicFileTest: Shall not exists before finalize
ok 2 - AtomicFileTest: Shall exists after finalize
ok 3 - AtomicFileTest: Shall have the correct data
ok 4 - AtomicFileTest: Neither shall exist before finalize
ok 5 - AtomicFileTest: Both shall exists after finalize
ok 6 - AtomicFileTest: First file shall contain the correct data
ok 7 - AtomicFileTest: Second file shall contain the correct data
ok 8 - AtomicFileTest: Appending does not update original before finalize
ok 9 - AtomicFileTest: Finalizing updates the appended data
ok 10 - AtomicFileTest: Read from Atomicfile
ok 11 - AtomicFileTest: Read from Atomicfile should read unfinalized data
ok 12 - AtomicFileTest: Two AtomicFiles should access same temp file (part 1)
ok 13 - AtomicFileTest: Two AtomicFiles should access same temp file (part 2)
ok 14 - AtomicFileTest: Two AtomicFiles should access same temp file (part 3)
ok 15 - AtomicFileTest: File not removed before finalize
ok 16 - AtomicFileTest: File is removed after finalize
ok 17 - AtomicFileTest: writes to symlinks end up in target
ok 18 - AtomicFileTest: shall maintain symlink
ok 19 - AtomicFileTest: AtomicFile::write_raw throws on error # skip
ok 20 - AtomicFileTest: AtomicFile::finalize_all() throws on error # skip
ok 21 - AtomicFileTest: AtomicFile::reset clears failure state # skip
ok 22 - AtomicFileTest: AtomicFile::append throws on error # skip
ok 23 - AtomicFileTest: AtomicFile::append did not partially fill the file. # skip
ok 24 - AtomicFileTest: AtomicFile::append failures prevent finalization # skip
```

Fixes #546

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2023-06-23 17:35:00 +02:00
Shaun Ruffell
c67a4715f8 AtomicFileTest: Fix test output to be test/problems --details compliant
Before this change, when AtomicFileTest had errors, there was no match for details:
```
$ test/problems --details test/all.log
Traceback (most recent call last):
  File "test/problems", line 145, in <module>
    details_errors[filename] += " - " + detail.match(line).group(1) + "\n"
AttributeError: 'NoneType' object has no attribute 'group'
```

Now the details are pulled out properly:
```
$ test/problems --details test/all.log
Failed:
AtomicFile.t (2):
 - AtomicFile::write_raw throws on error
 - AtomicFile::finalize_all() throws on error

Unexpected successes:

Skipped:

Expected failures:
```

Why these tests are failing on this particular host is a matter for another time...

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2023-06-23 17:35:00 +02:00
Thomas Lauf
2535c2c399 Cleanup includes
- Remove unused includes
- Use '<..>' style consistently
- Strip any paths from include
- Replace deprecated C++ headers
- Sort includes according to LLVM rules
  https://llvm.org/docs/CodingStandards.html#include-style

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-06-17 14:19:02 +02:00
Thomas Lauf
29d3043f29 Update copyright ranges
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-05-27 21:11:32 +02:00
Tomas Babej
e5870380a4
doc: Update copyright to 2021 2021-01-02 02:52:39 -05:00
Shaun Ruffell
48baa27057 test: Move TempDir to standalone file
I would like to use TempDir for the Datafile test in order to cleanup
any datafiles created as part of the test.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2020-08-11 10:39:34 +02:00
Shaun Ruffell
0a4644bfc7 AtomicFile: Add size() and remove() methods
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2020-08-10 22:24:52 +02:00
Thomas Lauf
368d033ce5 Rename atomic to AtomicFileTest
- Avoid possible clash with lib atomic on macOS, e.g. in /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:668

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-03-02 21:42:53 +01:00
Renamed from test/atomic.cpp (Browse further)