Skip to content

Commit

Permalink
Merge pull request #86 from qiaoyuang/main
Browse files Browse the repository at this point in the history
Update the concurrency test
  • Loading branch information
qiaoyuang authored Apr 24, 2024
2 parents 5c8fd07 + 0c25eef commit 2bfb76f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 173 deletions.
146 changes: 0 additions & 146 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,72 +43,12 @@ jobs:
- name: Build sqllin-driver
run: ./gradlew :sqllin-driver:assemble -PonCICD

- name: Run sqllin-driver macOS X64 Tests
run: ./test_driver_macos.sh

- name: Run sqllin-driver JVM Unit Tests on macOS X64
run: ./test_driver_jvm.sh

- name: Build sqllin-dsl
run: ./gradlew :sqllin-dsl:assemble -PonCICD

- name: Run sqllin-dsl macOS X64 Tests
run: ./test_dsl_macos.sh

- name: Run sqllin-dsl JVM Unit Tests on macOS X64
run: ./test_dsl_jvm.sh

- name: Gradle Cache
uses: gradle/gradle-build-action@v2

- name: AVD Cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-34

- name: Create AVD and Generate Snapshot for Caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
target: google_apis
arch: x86_64
profile: pixel_6
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- name: Run Android 14 Instrumented Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
target: google_apis
arch: x86_64
profile: pixel_6
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./test_android.sh

- name: Upload sqllin-driver Reports
uses: actions/upload-artifact@v2
with:
name: Test-Reports
path: sqllin-driver/build/reports
if: failure()

- name: Upload sqllin-dsl Reports
uses: actions/upload-artifact@v2
with:
name: Test-Reports
path: sqllin-dsl/build/reports
if: failure()

- name: Publish to MavenCentral
run: ./publish_apple_android_jvm.sh

Expand Down Expand Up @@ -143,35 +83,9 @@ jobs:
- name: Build sqllin-driver
run: ./gradlew :sqllin-driver:mingwX64MainKlibrary

- name: Run sqllin-driver MinGW X64 Tests
run: ./gradlew :sqllin-driver:cleanMingwX64Test && ./gradlew :sqllin-driver:mingwX64Test --stacktrace

- name: Run sqllin-driver JVM Unit Tests on MinGW X64
run: ./gradlew :sqllin-driver:cleanJvmTest && ./gradlew :sqllin-driver:jvmTest --stacktrace

- name: Build sqllin-dsl
run: ./gradlew :sqllin-dsl:mingwX64MainKlibrary

- name: Run sqllin-dsl MinGW X64 Tests
run: ./gradlew :sqllin-dsl:cleanMingwX64Test && ./gradlew :sqllin-dsl:mingwX64Test --stacktrace

- name: Run sqllin-dsl JVM Unit Tests on MinGW X64
run: ./gradlew :sqllin-dsl:cleanJvmTest && ./gradlew :sqllin-dsl:jvmTest --stacktrace

- name: Upload sqllin-driver Reports
uses: actions/upload-artifact@v2
with:
name: Test-Reports
path: sqllin-driver/build/reports
if: failure()

- name: Upload sqllin-dsl Reports
uses: actions/upload-artifact@v2
with:
name: Test-Reports
path: sqllin-dsl/build/reports
if: failure()

- name: Publish to MavenCentral
run: ./gradlew :sqllin-driver:publishMingwX64PublicationToMavenRepository && ./gradlew :sqllin-dsl:publishMingwX64PublicationToMavenRepository

Expand Down Expand Up @@ -206,74 +120,14 @@ jobs:
- name: Build sqllin-driver
run: ./gradlew :sqllin-driver:assemble -PonCICD

- name: Run sqllin-driver Linux X64 Tests
run: ./test_driver_linux.sh

- name: Run sqllin-driver JVM Unit Tests on Linux X64
run: ./test_driver_jvm.sh

- name: Build sqllin-processor
run: ./gradlew :sqllin-processor:assemble

- name: Build sqllin-dsl
run: ./gradlew :sqllin-dsl:assemble -PonCICD

- name: Run sqllin-dsl Linux X64 Tests
run: ./test_dsl_linux.sh

- name: Run sqllin-dsl JVM Unit Tests on Linux X64
run: ./test_dsl_jvm.sh

- name: Gradle Cache
uses: gradle/gradle-build-action@v2

- name: AVD Cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-26

- name: Create AVD and Generate Snapshot for Caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 26
target: default
arch: x86_64
profile: pixel_2
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- name: Run Android 8 Instrumented Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 26
target: default
arch: x86_64
profile: pixel_2
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./test_android.sh

- name: Upload sqllin-driver Reports
uses: actions/upload-artifact@v2
with:
name: Test-Reports
path: sqllin-driver/build/reports
if: failure()

- name: Upload sqllin-dsl Reports
uses: actions/upload-artifact@v2
with:
name: Test-Reports
path: sqllin-dsl/build/reports
if: failure()

- name: Publish to MavenCentral
run: ./publish_linux_processor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.ctrip.sqllin.dsl.sql.clause.OrderByWay.ASC
import com.ctrip.sqllin.dsl.sql.clause.OrderByWay.DESC
import com.ctrip.sqllin.dsl.sql.statement.SelectStatement
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlin.test.assertEquals
Expand Down Expand Up @@ -374,36 +375,32 @@ class CommonBasicTest(private val path: DatabasePath) {
val book1 = Book(name = "The Da Vinci Code", author = "Dan Brown", pages = 454, price = 16.96)
val book2 = Book(name = "The Lost Symbol", author = "Dan Brown", pages = 510, price = 19.95)
launch {
var statement: SelectStatement<Book>? = null
lateinit var statement: SelectStatement<Book>
database suspendedScope {
statement = BookTable { table ->
table INSERT listOf(book1, book2)
table SELECT X
}
}

launch {
val book1NewPrice = 18.96
val book2NewPrice = 21.95
val newBook1 = Book(name = "The Da Vinci Code", author = "Dan Brown", pages = 454, price = book1NewPrice)
val newBook2 = Book(name = "The Lost Symbol", author = "Dan Brown", pages = 510, price = book2NewPrice)
var newResult: SelectStatement<Book>? = null
database suspendedScope {
newResult = transaction {
BookTable { table ->
table UPDATE SET { price = book1NewPrice } WHERE (name EQ book1.name AND (price EQ book1.price))
table UPDATE SET { price = book2NewPrice } WHERE (name EQ book2.name AND (price EQ book2.price))
table SELECT X
}
assertEquals(true, statement.getResults().any { it == book1 })
assertEquals(true, statement.getResults().any { it == book2 })
}
launch {
val book1NewPrice = 18.96
val book2NewPrice = 21.95
val newBook1 = Book(name = "The Da Vinci Code", author = "Dan Brown", pages = 454, price = book1NewPrice)
val newBook2 = Book(name = "The Lost Symbol", author = "Dan Brown", pages = 510, price = book2NewPrice)
lateinit var statement: SelectStatement<Book>
database suspendedScope {
statement = transaction {
BookTable { table ->
table INSERT listOf(newBook1, newBook2)
table SELECT X
}
}

assertEquals(true, newResult!!.getResults().any { it == newBook1 })
assertEquals(true, newResult!!.getResults().any { it == newBook2 })
}

assertEquals(true, statement!!.getResults().any { it == book1 })
assertEquals(true, statement!!.getResults().any { it == book2 })
assertEquals(true, statement.getResults().any { it == newBook1 })
assertEquals(true, statement.getResults().any { it == newBook2 })
}
}
}
Expand Down Expand Up @@ -441,12 +438,12 @@ class CommonBasicTest(private val path: DatabasePath) {
lateinit var selectStatement: SelectStatement<NullTester>
// INSERT & SELECT
database {
NullTesterTable { table ->
selectStatement = NullTesterTable { table ->
table INSERT listOf(
NullTester(null, null, null),
NullTester(8, "888", 8.8),
)
selectStatement = table SELECT X
table SELECT X
}
}

Expand All @@ -467,9 +464,9 @@ class CommonBasicTest(private val path: DatabasePath) {

// UPDATE & SELECT
database {
NullTesterTable { table ->
selectStatement = NullTesterTable { table ->
table UPDATE SET { paramString = null } WHERE (paramDouble EQ 8.8)
selectStatement = table SELECT WHERE (paramInt NEQ null)
table SELECT WHERE (paramInt NEQ null)
}
}
val result1 = selectStatement.getResults().first()
Expand All @@ -480,9 +477,9 @@ class CommonBasicTest(private val path: DatabasePath) {

// DELETE & SELECT
database {
NullTesterTable { table ->
selectStatement = NullTesterTable { table ->
table DELETE WHERE (paramInt EQ null OR (paramDouble EQ null))
selectStatement = table SELECT X
table SELECT X
}
}
val result2 = selectStatement.getResults().first()
Expand Down

0 comments on commit 2bfb76f

Please sign in to comment.