Skip to content

Commit

Permalink
Run some tests in the fast-build configuration [WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
cxw42 committed Jul 20, 2019
1 parent 6d2c3f2 commit 6d3f2f1
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "tests"]
path = tests
url = git://github.com/editorconfig/editorconfig-core-test.git
url = https://github.com/cxw42/editorconfig-core-test.git
branch = cxwtest
18 changes: 12 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#
# Copyright (c) 2011-2018 EditorConfig Team
# All rights reserved.
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Expand Down Expand Up @@ -107,14 +107,20 @@ add_subdirectory(src)
add_subdirectory(doc)
add_subdirectory(include)

# Testing. Type "make test" to run tests. Only if the test submodule is
# checkouted should we do this
# Testing. Type "make test" to run tests. Only do this if the test submodule is
# checked out.
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt)
enable_testing()
set(EDITORCONFIG_CMD "${PROJECT_BINARY_DIR}/bin/editorconfig")
#set(EDITORCONFIG_CMD "${PROJECT_BINARY_DIR}/bin/editorconfig")
set(EDITORCONFIG_CMD "=editorconfig_bin")
add_subdirectory(tests)
message(STATUS "Tests enabled")
else()
message(WARNING
" Testing files are not found. Testing will not be available. If you obtained the source tree through git, please run `git submodule update --init` to update the tests submodule.")
endif()

# This is a way to find the EXE name for debugging. However, it issues a
# CMake warning under policy CMP0026.
#get_target_property(out_name editorconfig_bin LOCATION)
#message(STATUS "main: Editorconfig binary will be in -${out_name}-")
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

image:
- Visual Studio 2017

environment:
CONFIG: Release
VSVER: 15
matrix:
- ARCH: x86
# XXX x86 only, for faster testing

cache:
- C:/projects/editorconfig-core-c/bin/x86-static/build
- C:/projects/editorconfig-core-c/bin/x86-static/pcre2
#cache:
# - C:/projects/editorconfig-core-c/bin/x86-static/build
# - C:/projects/editorconfig-core-c/bin/x86-static/pcre2

install:
- cmake --version
Expand Down
14 changes: 7 additions & 7 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ param(
[int] $vsver = 15
)

# XXX for faster testing
if ($proj -eq "pcre2"){
if (Test-Path 'C:/projects/editorconfig-core-c/bin/x86-static/build/lib/pcre2-8.lib') {
"Skipping already-built $proj build" | Write-Host -ForegroundColor Green
exit
}
}
## XXX for faster testing
#if ($proj -eq "pcre2"){
# if (Test-Path 'C:/projects/editorconfig-core-c/bin/x86-static/build/lib/pcre2-8.lib') {
# "Skipping already-built $proj build" | Write-Host -ForegroundColor Green
# exit
# }
#}

$ErrorActionPreference="stop"

Expand Down
8 changes: 4 additions & 4 deletions init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ param(
)

# XXX for faster testing
if (Test-Path 'C:/projects/editorconfig-core-c/bin/x86-static/build/lib/pcre2-8.lib') {
"Skipping already-built $proj init" | Write-Host -ForegroundColor Green
exit
}
#if (Test-Path 'C:/projects/editorconfig-core-c/bin/x86-static/build/lib/pcre2-8.lib') {
# "Skipping already-built $proj init" | Write-Host -ForegroundColor Green
# exit
#}

$ErrorActionPreference="Stop"
$dest = "bin"
Expand Down
10 changes: 7 additions & 3 deletions src/bin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#
# Copyright (c) 2011-2012 EditorConfig Team
# All rights reserved.
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Expand Down Expand Up @@ -62,3 +62,7 @@ set_target_properties(editorconfig_bin PROPERTIES
install(TARGETS editorconfig_bin
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")

# This is a way to find the EXE name for debugging. However, it issues a
# CMake warning under policy CMP0026.
#get_target_property(out_name editorconfig_bin LOCATION)
#message(STATUS "src/bin: Generating -${out_name}-")
26 changes: 20 additions & 6 deletions test.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
param(
[ValidateSet("pcre2","core")]
[string] $proj = "core",

[ValidateSet("ON","OFF")]
[string] $static = "ON",

Expand All @@ -12,11 +12,11 @@ param(
[string] $arch = "x64"
)

# XXX Force succeed
"Force-succeeding" | Write-Host -ForegroundColor Green
exit(0)
## XXX Force succeed to save the cache
#"Force-succeeding" | Write-Host -ForegroundColor Green
#exit(0)

$ErrorActionPreference="stop"
# XXX $ErrorActionPreference="stop"


$dest = "bin"
Expand Down Expand Up @@ -44,7 +44,21 @@ $env:Path += ";" + (Resolve-Path $bin)
"Testing $proj" | Write-Host -ForegroundColor DarkGreen
Push-Location $dest
try {
ctest -E utf_8_char -R meta -VV --output-on-failure . -C $config
#ctest -E utf_8_char -R "meta|version" -VV --output-on-failure . -C $config
"Running test command: ctest -E utf_8_char -VV --output-on-failure . -C $config" |
Write-Host -ForegroundColor DarkGreen
ctest -E utf_8_char -VV --output-on-failure . -C $config
} finally {
Pop-Location
}

# XXX
"Manual test: doubled backslashes" | Write-Host -ForegroundColor Yellow
C:\projects\editorconfig-core-c\bin\x86-static\core\bin\Release\editorconfig.exe "-f" "path_separator.in" "C:/projects/editorconfig-core-c/tests/filetree\\path\\separator"
"End manual test" | Write-Host -ForegroundColor Yellow

"Manual test: single backslashes" | Write-Host -ForegroundColor Yellow
C:\projects\editorconfig-core-c\bin\x86-static\core\bin\Release\editorconfig.exe "-f" "path_separator.in" "C:/projects/editorconfig-core-c/tests/filetree\path\separator"
"End manual test" | Write-Host -ForegroundColor Yellow

"Done testing $proj" | Write-Host -ForegroundColor DarkGreen

0 comments on commit 6d3f2f1

Please sign in to comment.