Skip to content

Commit

Permalink
[REPLACE] Replace old name in all files
Browse files Browse the repository at this point in the history
This will change many files, and likely not build

Here is the script used to do the replacement:

```

NEWNAME="Scalar"
LOWERNAME="scalar"

for file in $(find . -type f -name '*')
    do
        if [[ $file == *.png ]]
        then
            continue
        fi
        if [[ $file == *.ico ]]
        then
            continue
        fi
        if [[ $file == *cddl1.txt ]]
        then
            continue
        fi
        if [[ $file == *.rc ]]
        then
            continue
        fi
        if [[ $file == *index_v4 ]]
        then
            continue
        fi
        if [[ $file == ./.git/* ]]
        then
            continue
        fi

        sed -i .bak "s/GVFS/$NEWNAME/g" "$file"
        sed -i .bak "s/VFS For Git/$NEWNAME/g" "$file"
        sed -i .bak "s/VFS for Git/$NEWNAME/g" "$file"
        sed -i .bak "s/VFSForGit/$NEWNAME/g" "$file"
        sed -i .bak "s/vfsforgit/$LOWERNAME/g" "$file"
        sed -i .bak "s/VFS/$NEWNAME/g" "$file"
        sed -i .bak "s/gvfs/$LOWERNAME/g" "$file"
    done

git commit -a -s -m "[REPLACE] Replace old name in all files" -m "This will change many files, and likely not build"
git clean -xdf
```

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
  • Loading branch information
derrickstolee committed Aug 10, 2019
1 parent fb3a2a3 commit 90e8c1b
Show file tree
Hide file tree
Showing 532 changed files with 4,420 additions and 4,420 deletions.
4 changes: 2 additions & 2 deletions .azure-pipelines/templates/macos-build-and-unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ steps:
certSecureFile: 'PrjFSKextCertExpiresJun6_2020_v2.p12'
certPwd: '$(kext.certificate.password)'

- script: Scripts/Mac/BuildGVFSForMac.sh $(configuration)
displayName: Build VFSForGit ($(configuration))
- script: Scripts/Mac/BuildScalarForMac.sh $(configuration)
displayName: Build Scalar ($(configuration))

- task: PublishTestResults@2
displayName: Publish test results
Expand Down
4 changes: 2 additions & 2 deletions .azure-pipelines/templates/windows-build-and-unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ steps:
& 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\sn.exe' -Vr *,31bf3856ad364e35
displayName: Disable strong name validation for MS delay-signed assemblies
- script: $(Build.Repository.LocalPath)\Scripts\BuildGVFSForWindows.bat $(configuration) $(majorAndMinorVersion).$(revision)
displayName: Run VFSForGit build script ($(configuration))
- script: $(Build.Repository.LocalPath)\Scripts\BuildScalarForWindows.bat $(configuration) $(majorAndMinorVersion).$(revision)
displayName: Run Scalar build script ($(configuration))

- script: $(Build.Repository.LocalPath)\Scripts\RunUnitTests.bat $(configuration)
displayName: Run unit tests
Expand Down
6 changes: 3 additions & 3 deletions .azure-pipelines/templates/windows-functional-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ steps:
artifactName: FunctionalTests_$(platformFriendlyName)_$(configuration)
downloadPath: $(Build.BinariesDirectory)

- script: $(Build.BinariesDirectory)/FunctionalTests_$(platformFriendlyName)_$(configuration)/src/Scripts/ReinstallGVFS.bat $(configuration)
displayName: Run VFSForGit and G4W installers
- script: $(Build.BinariesDirectory)/FunctionalTests_$(platformFriendlyName)_$(configuration)/src/Scripts/ReinstallScalar.bat $(configuration)
displayName: Run Scalar and G4W installers

- script: git config --global credential.interactive never
displayName: Disable interactive auth

- script: $(Build.BinariesDirectory)/FunctionalTests_$(platformFriendlyName)_$(configuration)/src/Scripts/RunFunctionalTests.bat $(configuration) --test-gvfs-on-path
- script: $(Build.BinariesDirectory)/FunctionalTests_$(platformFriendlyName)_$(configuration)/src/Scripts/RunFunctionalTests.bat $(configuration) --test-scalar-on-path
displayName: Run functional tests

- task: PublishTestResults@2
Expand Down
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
###############################################################################
# Do not normalize any line endings.
###############################################################################
* -text
* -text
2 changes: 1 addition & 1 deletion .vsconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"Microsoft.Net.Component.4.6.1.TargetingPack",
"Microsoft.Net.Component.4.6.1.SDK",
]
}
}
46 changes: 23 additions & 23 deletions AuthoringTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@

#### Runnable functional test projects

- `GVFS.FunctionalTests`
- `GVFS.FunctionalTests.Windows`
- `Scalar.FunctionalTests`
- `Scalar.FunctionalTests.Windows`

`GVFS.FunctionalTests` is a .NET Core project and contains all cross-platform functional tests. `GVFS.FunctionalTests.Windows`, contains functional tests that require Windows. Additionally, `GVFS.FunctionalTests.Windows` includes all the `GVFS.FunctionalTests` allowing it to run both cross-platform and Windows-specific functional tests.
`Scalar.FunctionalTests` is a .NET Core project and contains all cross-platform functional tests. `Scalar.FunctionalTests.Windows`, contains functional tests that require Windows. Additionally, `Scalar.FunctionalTests.Windows` includes all the `Scalar.FunctionalTests` allowing it to run both cross-platform and Windows-specific functional tests.

#### Other functional test projects

*GVFS.NativeTests*
*Scalar.NativeTests*

`GVFS.NativeTests` contains tests written in C++ that use the Windows API directly. These tests are called from the managed tests (see above) using PInvoke.
`Scalar.NativeTests` contains tests written in C++ that use the Windows API directly. These tests are called from the managed tests (see above) using PInvoke.

*GVFS.FunctionalTests.LockHolder*
*Scalar.FunctionalTests.LockHolder*

The `LockHolder` is a small program that allows the functional tests to request and release the `GVFSLock`. `LockHolder` is useful for simulating different timing/race conditions.
The `LockHolder` is a small program that allows the functional tests to request and release the `ScalarLock`. `LockHolder` is useful for simulating different timing/race conditions.

## Running the Functional Tests

The functional tests are built on NUnit 3, which is available as a set of NuGet packages.

### Windows

1. Build VFS for Git:
1. Build Scalar:

**Option 1:** Open GVFS.sln in Visual Studio and build everything.
**Option 1:** Open Scalar.sln in Visual Studio and build everything.

**Option 2:** Run `Scripts\BuildGVFSForWindows.bat` from the command line
**Option 2:** Run `Scripts\BuildScalarForWindows.bat` from the command line

2. Run the VFS4G installer that was built in step 2. This will ensure that VFS4G will be able to find the correct version of the pre/post-command hooks. The installer will be placed in `BuildOutput\GVFS.Installer.Windows\bin\x64\<Debug or Release>`
2. Run the Scalar4G installer that was built in step 2. This will ensure that Scalar4G will be able to find the correct version of the pre/post-command hooks. The installer will be placed in `BuildOutput\Scalar.Installer.Windows\bin\x64\<Debug or Release>`
3. Run the tests **with elevation**. Elevation is required because the functional tests create and delete a test service.

**Option 1:** Run the `GVFS.FunctionalTests.Windows` project from inside Visual Studio launched as Administrator.
**Option 1:** Run the `Scalar.FunctionalTests.Windows` project from inside Visual Studio launched as Administrator.

**Option 2:** Run `Scripts\RunFunctionalTests.bat` from CMD launched as Administrator.

Expand All @@ -50,23 +50,23 @@ By default, the functional tests run a subset of tests as a quick smoke test for

### Mac

1. Build VFS for Git: `Scripts/Mac/BuildGVFSForMac.sh`
1. Build Scalar: `Scripts/Mac/BuildScalarForMac.sh`
2. Run the tests: `Scripts/Mac/RunFunctionalTests.sh `

If you need the VS for Mac debugger attached for a functional test run:

1. Make sure you've built your latest changes
2. Open GVFS.sln in VS for Mac
2. Open Scalar.sln in VS for Mac
3. Run->Run With->Custom Configuration...
4. Select "Start external program" and specify the published functional test binary (e.g. `/Users/<USERNAME>/Repos/VFSForGit/Publish/GVFS.FunctionalTests`)
4. Select "Start external program" and specify the published functional test binary (e.g. `/Users/<USERNAME>/Repos/Scalar/Publish/Scalar.FunctionalTests`)
5. Specify any desired arguments (e.g. [a specific test](#Running-Specific-Tests) )
6. Run Action -> "Debug - .Net Core Debugger"
7. Click "Debug"

### Customizing the Functional Test Settings

The functional tests take a set of parameters that indicate what paths and URLs to work with. If you want to customize those settings, they
can be found in [`GVFS.FunctionalTests\Settings.cs`](/GVFS/GVFS.FunctionalTests/Settings.cs).
can be found in [`Scalar.FunctionalTests\Settings.cs`](/Scalar/Scalar.FunctionalTests/Settings.cs).


## Running Specific Tests
Expand All @@ -79,20 +79,20 @@ Note that the test name must include the class and namespace and that `Debug` or

Windows (Script):

`Scripts\RunFunctionalTests.bat Debug --test=GVFS.FunctionalTests.Tests.EnlistmentPerFixture.GitFilesTests.CreateFileTest`
`Scripts\RunFunctionalTests.bat Debug --test=Scalar.FunctionalTests.Tests.EnlistmentPerFixture.GitFilesTests.CreateFileTest`

Windows (Visual Studio):

1. Set `GVFS.FunctionalTests.Windows` as StartUp project
2. Project Properties->Debug->Start options->Command line arguments (all on a single line): `--test=GVFS.FunctionalTests.Tests.EnlistmentPerFixture.GitFilesTests.CreateFileTest`
1. Set `Scalar.FunctionalTests.Windows` as StartUp project
2. Project Properties->Debug->Start options->Command line arguments (all on a single line): `--test=Scalar.FunctionalTests.Tests.EnlistmentPerFixture.GitFilesTests.CreateFileTest`

Mac:

`Scripts/Mac/RunFunctionalTests.sh Debug --test=GVFS.FunctionalTests.Tests.EnlistmentPerFixture.GitFilesTests.CreateFileTest`
`Scripts/Mac/RunFunctionalTests.sh Debug --test=Scalar.FunctionalTests.Tests.EnlistmentPerFixture.GitFilesTests.CreateFileTest`

## How to Write a Functional Test

Each piece of functionality that we add to VFS for Git should have corresponding functional tests that clone a repo, mount the filesystem, and use existing tools and filesystem
Each piece of functionality that we add to Scalar should have corresponding functional tests that clone a repo, mount the filesystem, and use existing tools and filesystem
APIs to interact with the virtual repo.

Since these are functional tests that can potentially modify the state of files on disk, you need to be careful to make sure each test can run in a clean
Expand All @@ -101,12 +101,12 @@ as the base class, because NUnit treats namespaces like test suites, and we have

1. `TestsWithLongRunningEnlistment`

Before any test in this namespace is executed, we create a single enlistment and mount VFS for Git. We then run all tests in this namespace that derive
Before any test in this namespace is executed, we create a single enlistment and mount Scalar. We then run all tests in this namespace that derive
from this base class. Only put tests in here that are purely readonly and will leave the repo in a good state for future tests.

2. `TestsWithEnlistmentPerFixture`

For any test fixture (a fixture is the same as a class in NUnit) that derives from this class, we create an enlistment and mount VFS for Git before running
For any test fixture (a fixture is the same as a class in NUnit) that derives from this class, we create an enlistment and mount Scalar before running
any of the tests in the fixture, and then we unmount and delete the enlistment after all tests are done (but before any other fixture runs). If you need
to write a sequence of tests that manipulate the same repo, this is the right base class.

Expand Down
Loading

0 comments on commit 90e8c1b

Please sign in to comment.