Commit Graph
24 Commits
Author SHA1 Message Date
Gil 7a58eba2e5 Remove firebase/firestore from paths in Firestore/core (#5374)
* Manual Xcode project fixups

* Remove `firebase/firestore` from paths in Firestore/core

This renames all Firestore files under `Firestore/core` to remove the
interior `firebase/firestore` directory structure. This is motivated by
build failures under Windows where the filenames of intermediates were
too long.

Concretely:

  * `Firebase/core/src/firebase/firestore` becomes `Firebase/core/src`
  * `Firebase/core/test/firebase/firestore` becomes
    `Firebase/core/test/unit`

Moving the tests into a `unit` subdirectory aligns Firestore with the
directory structure in
[AddNewPod](https://github.com/firebase/firebase-ios-sdk/blob/master/AddNewPod.md),
modified for C++ (see discussion in #3224).
2020-04-20 14:57:34 -07:00
Paul BeusterienandMarek Gilbert 4ea4340285 Upgrade clang-format (#5265)
Co-authored-by: Marek Gilbert <mcg@google.com>
2020-04-03 11:38:31 -07:00
Konstantin Varlamov 62ef244cde C++ migration: remove the dependency on Objective-C Protobuf library (#4189) 2019-11-07 20:39:53 -05:00
Konstantin Varlamov 04177614d0 Fix fuzz build (#4192) 2019-10-30 14:30:52 -04:00
Konstantin Varlamov 2c53bb9139 C++ migration: use C++ serializer for communicating with the local store (#4116)
After this PR is merged, the Objective-C serializers can be completely removed from the project. Also, this PR changes the `Message` class quite a bit; it's probably in its final form now.

I did some performance testing locally and came to the conclusion that replacing Objective-C serializers with their C++ versions brings no performance downgrade; actually, there seems to be a very slight improvement. I tested writing large batches and reading large collections:
* both are network-dominated; wall time is about twice longer than CPU time;
* serialization represents a pretty small percentage of the total CPU time;
* for writing, C++ serialization is a little more efficient, taking ~6% of total CPU time, compared to ~8% in the Objective-C version. I've seen similar results for reading.

All integration tests pass, under Address Sanitizer as well.
2019-10-22 21:52:55 -04:00
Gil fa5fc75d37 Use ByteString in nanopb::Reader/Writer (#3119)
* Simplify nanopb::Reader/Writer construction

* Reuse ByteString construction in serializer

* Add nanopb_testing.h
2019-06-03 18:10:26 -07:00
Gil 8770828dd8 Refactor usages of DatabaseId to avoid raw pointers (#3041)
* Remove stale references to DatabaseId
* Have Firestore take the DatabaseId directly
* Allow tests to default the database implicitly
* Have FSTSerializerBeta take DatabaseId by value
* Have FSTUserDataConverter take DatabaseId by value
* Make FIRFirestore.databaseID a const reference
* Make FSTFirestoreClient.databaseID a const reference
* Have FSTReferenceValue take DatabaseId by value
* Have DatabaseInfo take DatabaseId by value
* Have Serializer take DatabaseId by value
* Fix C++ ReferenceValue
  * Take DatabaseId by value
  * Reverse order to match Android
  * Rename `reference` to `key`
2019-05-21 20:28:51 -07:00
rsgowman 020eb60193 Simplify Serializer [En|De]code*() methods to no longer [de]serialize… (#2013)
Now, we use the re-worked nanopb deserializer (that mallocs). This also
had the advantage of moving the C++ serialization code closer to the
other platforms.

Still TODO:
- Reorder the methods within the files to resemble the other platforms.
2019-01-07 17:18:13 -05:00
Paul Beusterien 7c53489e03 Travis to Xcode 10.1 and clang-format to 8.0.0 (tags/google/stable/2018-08-24) (#2222)
* Travis to Xcode 10.1
* Update to clang-format 8
* Update clang-format homebrew link
* Work around space in filename style.sh issue
2019-01-02 09:27:31 -08:00
Gil 6af931d4e8 Migrate Firestore to the v1 protocol (#2200)
* Use python executable directly

  * python2 is not guaranteed to exist
  * scripts aren't directly executable on Windows

* Add Firestore v1 protos

* Point cmake at Firestore v1 protos

* Regenerate protobuf-related sources

* Make local protos refer to v1 protos

* fixup! Regenerate protobuf-related sources

* Remove v1beta1 protos

* s/v1beta1/v1/g in source.

* s/v1beta1/v1/ in the Xcode project

* Remove stale bug comments.

This was fixed by adding an explicit FieldPath API rather than exposing
escaping to the end user.
2018-12-21 11:28:48 -08:00
Konstantin Varlamov dd36990096 Fix log overflow in continuous fuzz testing (#2020)
Prevent generating too many "Unrecognized selector" console messages that eventually make Travis kill the job due to log exceeding limits.
2018-10-30 00:15:22 -04:00
Mina Farid b5afc6b522 Run fuzzing as a travis cron job (#1662)
* Added fuzzing script to run all fuzzing targets on cron jobs.
* Added travis fuzzing script and `FUZZING_DURATION` to control fuzzing time.
* Given a total fuzzing duration, select 1 target to run for half of
  the duration, and divide the remaining duration over the rest of
  targets equally.
2018-08-16 18:20:08 -04:00
Mina Farid f7b5869df4 Adding Fuzzing Test Target LevelDb (#1685) 2018-08-14 17:18:32 -04:00
Mina Farid d6075418fa Fuzz test internal method in FIRFieldPath (#1675) 2018-08-13 14:02:38 -04:00
rsgowman 786f7666f9 Refactor serializers (#1625)
* Use nanopb::Reader, Writer, in the serializer's public methods. This eliminates overloads that take raw bytes.
* Refactor the serializer's return values from Status, StatusOr<T> to void, optional<T> (or unique_ptr<T>) for encoding/decode methods, respectively.
* Errors during serializer encoding methods now fatal. Previously, we'd propagate the errors back to the caller, but there aren't any errors that could realistically be recovered from. So now we just abort(). (This is in contrast to *de*coding methods, which could generate errors that we might want to recover from.)
* Reduce early returns in the serializers
* Unify public/private method return values of the serializers. Now the private methods return void/optional, just like the public methods.
* Reader::ReadTag now tracks the last read tag. This allows:
  * RequireWireType to not need it as a parameter
  * SkipField to not need it as a parameter
  * ReadTag to be inlined into most switch statements
* Move RequireWireType into ReadX methods
* Reader::SkipField -> Reader::SkipUnknown
* Add ReadNestedMessage overload in order to accept non-static functions.
* Add a few using statements to simplify code. (Also keeps local serializer more in sync with the remote serializer.)
* Use nullopt/nullptr instead of {}
* Reader::update_status() -> Fail()
* Add DecodeSnapshotVersion
* Don't directly update status within nanopb::Reader. Instead, call Reader::Fail() (which calls Status::Update()). This ensures we don't accidentally overwrite the first error status with
a subsequent one.
2018-08-08 17:32:25 -04:00
Mina Farid 50dbc19456 Rename fuzz targets and use dictionary and corpus (#1628)
* Rename fuzz targets and use dictionary and corpus
* Added a comment about naming
2018-08-03 16:12:05 -04:00
Mina Farid 31f6f804c5 Added fuzz testing target: FIRFieldPath (#1575)
* Added `FIELDPATH` to the list of available fuzzing targets.
* Added fuzzing method for creating `FIRFieldPath` objects.
* Added corpus and dictionary for `FIRFieldPath`.
2018-07-27 15:25:13 -04:00
Mina Farid 143c36c232 Fuzz testing refactoring (#1563)
* Added fuzzing targets read from env variable.
* Refactored Serializer fuzz tests in a separate file
* Separate header file for each fuzzing target.
* Write crashing outputs using `artifact_prefix` flag to `NSTemporaryDirectory`.
2018-07-23 09:55:32 -04:00
Mina Farid ab8ec2d725 Multiple fuzz testing targets (#1550)
* Read fuzzing target `FUZZING_TARGET` environment variable.
2018-07-19 17:02:02 -04:00
Mina Farid 22562f49eb Fuzz testing uses protoc from a pod dependency (#1538) 2018-07-16 13:55:10 -04:00
Mina Farid 730780faf4 Fuzz testing Serializer with a dictionary and corpus (#1513)
Added functionality to read dictionary file and seed input corpus from bundle
2018-07-13 15:02:48 -04:00
Mina Farid 37edbc694d Fuzz test Serializer to decode FieldValue (#1485) 2018-07-03 13:40:50 -04:00
Mina Farid f5bf0a37a7 Fuzz testing Header Search Paths settings (#1395)
* Modified `HEADER_SEARCH_PATHS` in the project file.
2018-06-11 17:23:07 -04:00
Mina Farid a135ee1717 Add a new Xcode target and scheme for fuzz tests (#1364)
Created `Firestore_FuzzTests_iOS` Xcode target as a duplicate of the target
  `Firestore_Tests_iOS`.
    - Added `-fsanitize-coverage=trace-pc-guard` to the compiler flags to enable
      code coverage by libFuzzer fuzzing driver.
    - Modified the files to compile to the fuzz testing ones.
    - Added a Principal testing class.
* Modified the `Podfile` to include `LibFuzzer.podspec` as a dependency for
  the target `Firestore_FuzzTests_iOS`.
* Added a skeleton for fuzz testing. Currently does not test any code but
  the fuzzing works fine and calls an empty `LLVMFuzzerTestOneInput`
  with different input values.
    - This means that fuzzing does not finish or crash.
2018-06-04 14:36:55 -04:00